Skip to content

Instantly share code, notes, and snippets.

@kagemusha
Created December 14, 2011 20:53
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 kagemusha/1478469 to your computer and use it in GitHub Desktop.
Save kagemusha/1478469 to your computer and use it in GitHub Desktop.
Git Strategy
(courtesy OpenGotham)
Setting up a local git clone of project
git clone git@github.com:<project>.git
Branching Workflow
All work is done in topic branches. Generally a topic branch maps directly to a feature requests.
Before a developer begins to work on code they should :
git co -b wip_short_desc_of_intended_wk
After work the feature tests pass and the developer deems the work done. They add the files modified to the impending commit.
git add app/view app/controller
git commit -m "short message explaining work done"
With a commit in place switch back to the master branch:
git co master
and update any incoming changes from other team members working on other features
git pull --rebase
switch back to the topic branch
git co wip_short_desc_of_intended_wk
and apply the current commit to the incoming code updated in master
git rebase master
switch again to master
git co master
and merge the topic branch changes into the master branch
git merge wip_short_desc_of_intended_wk
With that done the feature work is set to be pushed to github after a quick check for test failures with rake
rake #all tests should pass
git push
Once that is done the feature story can be marked finished and the code is clear to deploy to staging
git push heroku master
After the feature is on staging the story is marked delivered and awaits acceptance
Remote Branches
If you have work that is not ready to be merged into master at the end of the day create a remote branch and push a WIP commit.
git push -u origin wip_short_desc_of_intended_wk
WIP branches are considered volitile and rewriting history is common. This allows you to resume your work the next morning by popping the WIP commit off head.
git reset head^
Continue your work making frequent atomic commits when possible. If you need to push to the remote branch you will have to force it.
git push -f origin wip_short_desc_of_intended_wk
Be sure to clean up after yourself by removing the remote branch when you're done with it.
git push origin :wip_short_desc_of_intended_wk
Commit Messages
If your commit represents the completion of a story in Pivotal Tracker, mark it completed in the commit message.
Member makes a delicious pie
[finishes #1872928]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment