Skip to content

Instantly share code, notes, and snippets.

@aikalima
Last active December 20, 2015 12:49
Show Gist options
  • Save aikalima/6133784 to your computer and use it in GitHub Desktop.
Save aikalima/6133784 to your computer and use it in GitHub Desktop.

git cheat sheet for WDI group projects

Once:

  • Create git repository, invite collaborators
  • Someone commits initial version, everyone else clones it

Day to day:

  • git checkout -b my_branch

my_branch could be your name or feature you are currently working on. You are now working in your own private branch

  • Do some work on this branch committing early and often (for instance, whenever your tests pass). Rebase against the upstream frequently to prevent your branch from diverging significantly:

  • git fetch origin master

  • git rebase master

  • When done, commit ...

  • git commit -a -m "a useful comment"

Commits changes to your local repo/branch. Option -a commits all changed files.

  • time to merge and push ...

  • git checkout master

Check out 'master' which implicitly switches you back to master branch

  • git merge my_branch

Syncs your branch with master (locally)

  • git push origin master

Push to github. Start over ... :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment