Skip to content

Instantly share code, notes, and snippets.

@localshred
Created October 16, 2009 05:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save localshred/211594 to your computer and use it in GitHub Desktop.
Save localshred/211594 to your computer and use it in GitHub Desktop.
My simple git workflow for using topic branches
# This is a simple descriptor on how I do topic development using git
# Some of the commands are java flavored (like ant),
# but that doesn't mean you can't use this with other languages.
# Step 1 - Synchronize master.
# 1.1 - Checkout master branch
# 1.2 - Get changes from origin
git checkout master
git pull
# Step 2 - Create a new branch to do all widget development.
git co -b widget
# Step 3 (recursive) - Write tests, write code, and commit.
# For every user story in the project, follow this flow:
# 1.1 - Write tests
# 1.2 - Write code to pass the tests
# 1.3 - When the story is completed and the tests pass, commit the code.
# Lather, rinse, repeat until code complete on the project
git add .
git commit -m "Some message about your commit"
# Step 4 - Synchronize master
# 4.1 - Fix any conflicts and commit
git checkout master
git pull
# Do 4.1 if you need to
# Step 5 - Merge the topic branch into master
# 5.1 - Fix any conflicts and commit
git merge widget
# Do 5.1 if you need to
# Step 6 - Fix conflicts, run compiles, run tests
# If tests or compilation fail, go back to step 3
ant compile
ant test # or whatever testing procedure you use
# Step 7 - Push code to origin
# Only perform this step once you have resolved
# all conflicts and all automated tests pass
git push origin master
# Step 8 - Remove your topic branch when topic development has ceased
git branch -d widget
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment