-
Notifications
You must be signed in to change notification settings - Fork 45
Git Workflow
We have a small enough team that, for now, we do all work on the master
branch. You do not need to create a feature branch for each feature, but you do need to avoid pushing breaking changes.
-
Make sure tests pass. This is a great moment to write your tests if you haven't already. All code, front and back end, needs unit tests.
python manage.py test npm test
-
Check what you've changed. Use the GUI in your editor (VS Studio, PyCharm) or do
git diff
-
If it all looks good, commit. Again you can use your GUI, or to commit all changed files do
git commit -am "My changes"
-
Push to the server
git push
-
At this point you may discover that other people have pushed before you. The default git approach is to do one big merge commit. But this ends up in a very messy large commit where like this one where it's impossible to see the actual changes. Instead, we use rebasing, which replays the new commits locally and appends your work on top of it. So if others have commits on master ahead of you, do
git pull --rebase
-
There may be conflicts. If so, edit each file with conflicts, then do
git add <conflicted file>
to tell git you are done fixing that file. When done fixing and adding all merge conflicts:
git rebase --continue
And finally:
git push