Skip to content

Instantly share code, notes, and snippets.

@petros
Created December 27, 2010 16:42
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 petros/756275 to your computer and use it in GitHub Desktop.
Save petros/756275 to your computer and use it in GitHub Desktop.
Git workflow

We all push and pull from master branch. Code changes should only be pushed to github if all tests are green.

Below is a common workflow for a team working with a central repo. several variations are possible, but if unsure, please go by this:

  1. if you are working from a Pivotal Tracker story, click "start" on that story
  2. git pull
  3. rake db:migrate
  4. rake db:test:prepare
  5. spec spec
  6. cucumber (if we are using it)
  7. if either are not green, stop here and investigate. do not continue to develop until all green.
  8. git checkout -b my_work (create and switch to a local branch where you'll do your work, it's a good practice to give a name to your local branch, that relates to the PT story)
  9. do a little coding
  10. make sure the tests are passing
  11. git add . (or add selectively)
  12. git commit -m "[#NNNNNNN] bla bla" (where NNNNNN is the PT story id)
  13. repeat steps 7, 8 and 9 as many times as you wish
  14. git checkout master
  15. git pull origin master (you do this at this step in case someone else pushed while you were working)
  16. if that git pull says 'Already up-to-date', proceed to step 20,
  17. run tests again
  18. git checkout my_work
  19. git rebase master
  20. git checkout master
  21. git merge my_work
  22. git push origin master
  23. if you're working from Pivotal Tracker, click "finish" and then "deliver" on the story you just completed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment