Skip to content

Instantly share code, notes, and snippets.

@sionc
Created May 17, 2013 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sionc/5597512 to your computer and use it in GitHub Desktop.
Save sionc/5597512 to your computer and use it in GitHub Desktop.
Branching workflow for git
git branch -a
→ Displays all branches (including remote branches)
git checkout -b [local-branch] origin/[remote-branch]
→ Create a new local-branch (e.g. test-remote) based on remote branch (e.g develop)
git fetch
→ Fetch code from remote
git merge origin/[remote-branch]
→ Merge recent changes from remote-branch (e.g develop) into currently selected local branch (e.g. test-remote)
git add .
→ Stages changes for commit
git commit
→ Opens up vi editor for commit message. Use following format for commit message in insert mode (i)
[Tag] Summary upto 50 chars
Brief description (wrap around after 72 chars or so)
Hit <esc> and type :wq in command mode to commit changes
git push origin [local-branch]:[remote-branch]
OR
git push origin [remote-branch] (if [local-branch] == [remote-branch] )
→ Push changes from local branch (e.g. test-remote) into a remote branch (e.g. develop)
git push origin :[remote-branch]
→ Delete a remote branch (e.g. develop)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment