Skip to content

Instantly share code, notes, and snippets.

@bsodmike
Created August 31, 2011 20:29
Show Gist options
  • Save bsodmike/1184632 to your computer and use it in GitHub Desktop.
Save bsodmike/1184632 to your computer and use it in GitHub Desktop.
Git Workflow for Working with Shared Branches
#Workflow
git co development
git pull
git co -b todays_work // create new temp working branch
...do some work...
git commit
git co development
git pull ----- (remote changes come in)
### inspect all changes ###
git co todays_work
git rebase development
git co development
git merge todays_work (there is no merge here, just what is called a fast forward)
git push
git branch -D todays_work // delete the temp working branch
@bsodmike
Copy link
Author

Handy git commands:

  • git ci -m "descriptive commit" & git stash save descriptive comment here // this will temporarily place any 'dirty' changes into the stash.
    // you can switch branches and pop the stashed commit by doing git stash pop
  • git revert [SHA] // great for undoing, creates a new commit reverting changes in whatever SHA.
  • git reset --hard [SHA] // reset all the way back to the specified commit.
  • git rebase -i HEAD~x // include the -p flag if you want to retain valuable merge commits.

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