Skip to content

Instantly share code, notes, and snippets.

@pjaspers
Created May 8, 2010 14:33
Show Gist options
  • Save pjaspers/394589 to your computer and use it in GitHub Desktop.
Save pjaspers/394589 to your computer and use it in GitHub Desktop.
Git basic workflow
We (http://10to1.be) 're heavy github users so I'm going to inlcude them in the workflow (feel free to replace them with another server).
Github repo is containing the project
1. Make sure you are in the master branch
2. Do a pull.
3. Create a branch to do your work in (git checkout -b "solving_the_bug")
4. Do your work.
5. Switch back to the master branch (git checkout master)
6. Do a pull (git pull) --this to make sure the master branch is up to date.
7. Switch back to your feature branch (git checkout solving_the_bug
8. Now rebase your branch to the master one (git rebase master)
(Or even better do it interactively (git rebase -i master) this way you can merge commits and clean up commit messages)
-- This will make sure your branch applies cleanly to the master branch
9. Switch back the master branch (git checkout master)
10. Merge your branch (this will work without a hitch because you've already rebased your feeature_branch) (git merge solving_the_bug)
11. Push it back to github (git push)
12. Delete the feature branch (git branch -d solving_the_bug)
This might seem like a lot of work; but really it isn't. And the added value is pretty great, your master branch stays clean, so you've always got a build that works. You can clean up commits with ease and you're commit historys won't gent any autmatic merges in them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment