When I've worked in a multi-user project this is how the workflow goes:
Guy A makes changes in local repo -> Push changes to remote repo
Guy B makes changes in local repo -> Push changes to remote repo (It would fail here)
Guy B does a
git fetch
followed bygit merge
or agit rebase
so that his changes are merged with the changes from the remote. Guy B should immediately push these changes to the remoteGuy A does some more changes in his local repo -> Push changes (It would fail again). He follows a similar set of steps to Guy B on merging or rebasing.
And speaking in Github terms, the concept of pushing changes to remote repo is handled as a pull request
in github. When someone sends a pull request to some branch in some repo, it is the requester's responsibility to do the merge/rebase of his changes against this target and then send the pull request
.
If the user receiving the pull request sees a lot of conflicts either because the requester didn't take enough pains to do the merges or because there were prior pull requests he had to take care of, which now causes conflicts, then the owner can ask the requester to send an updated pull request
on top of the latest changes.
In other words, the person receiving the pull request would usually be happy only to accept fast-forward merges
, but there are few minor exceptions.