Skip to content

Github Basic Commands (Terminal)

juanfrans edited this page Dec 28, 2014 · 7 revisions

Basic Workflow

  • Once you've created the repository and done your first commit, or forked it onto your local drive this is the basic workflow:
  • git status - displays what files have changed or been added or deleted.
  • git add -A - adds all changes ("stages" the files). The A flag adds all changes.
  • git commit -m "your message" - commits all changes and adds a message describing this change.
  • git push - pushes your changes to the remote repository.
  • Here's a very useful cheat sheet with multiple basic git commands.

Synchronizing Changes

  • You may do this in a couple of ways. You can use git fetch in combination with git merge or just git pull. The recommended method is just to do git pull. Here's a description of what they do:
  • git fetch - gets all the changes from the repository but doesn't change your local files.
  • git merge - combines the changes that you just fetched to update your files.
  • git pull - downloads all the changes and updates your local files.

Other

  • rm -rf .git/ - to remove that directory from “version control”.

More info here by Dennis Tenen.