If you are both pushing to the same branch (for example master), then the second one to push (say developerB) will fail, as in here, with:
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and merge the remote changes
hint: (e.g. 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
In that case, I recommend a git stash + git pull --rebase
which will:
- stash any current modification (not yet committed)
- fetch the updated
origin/master
branch (with developerA app.py
modifications
- replay developerB local commits (which are not pushed, since the push just failed) on top of
origin/master
(you can automate that git stash + git rebase process with a bit of configuration: see "Can “git pull
” automatically stash and pop pending changes?")
If there are any merge conflicts, they will be resolved locally, on developerB's workstation, with local compilation and tests to validate that developerB's changes are working with what developerA has pushed.
Once the rebase is completed, a simple git push
form developerB will work (assuming that developerA has not pushed again on the common branch)
You can avoid that of course by pushing to a dedicated branch for each developer, but you will need to reconcile those parallel development at some point.
At least, with the workflow I describe above, if both developers are participating to the same development effort, that reconciliation will be sooner rathen than later.