Skip to content

Instantly share code, notes, and snippets.

@carlcrott
Last active September 21, 2017 21:51
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 carlcrott/79cf989612515279bbbffc2339d2ea66 to your computer and use it in GitHub Desktop.
Save carlcrott/79cf989612515279bbbffc2339d2ea66 to your computer and use it in GitHub Desktop.
Git workflow for centralized repo + multiple contributors
Code changes should only be pushed to github if all tests are passing.
Below is a common work-flow for a team working with a central repo.
Variations are possible, but if unsure, please go by this:
1. Git pull (or, if this is your first time ever getting the code, do git clone git@github.com:our_repo/our_repo.git to get a local copy of the repo)
2. Run tests
3. If tests fail, stop here and investigate. Do not continue to develop until all tests are passing.
4. git checkout -b my_work (create and switch to a local branch where you'll do your work)
** Code up / nerd out / hack away **
5. Run tests + verify they're passing
6. git commit
7. repeat steps 5, 6 and 7 as many times as you wish
8. If you want to rebase + squash commits, do that now. Ensure rebase goes cleanly
9. Run tests + verify they're passing
10. git checkout master
11. git pull (you do this at this step in case someone else pushed while you were working)
12. If that git pull says 'Already up-to-date', proceed to next step, otherwise run tests again.
** There should be NO CONFLICTS on pulling master. If you have them, theres a problem. **
13. git checkout my_work
14. git rebase master
15. git checkout master
19. git merge my_work
20. git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment