In the simplest case, when everyone commits and pushes into one branch, push will be rejected from the second. He will have to first make git pull and combine the changes made remotely before sending his own. By default, Git does not allow rewriting fragments of the commit tree, only to supplement it.
If they changed different projects, then conflicts are unrealistic, and just git pull will suffice (so that remote changes merge with local ones), and then re- git push .
There is a particularly harsh technique for keeping a straight story, git pull --rebase , but before using it, it’s worth exploring how it works and how it can be dangerous.
In the normal case, it is better to work in separate branches (which can even exist in different repositories, in the case of forks).
Everyone reaches a stable state in his branch and makes a pull request (PR) (merge request or MR in some places) and according to the procedure adopted in the command (say, if at least two people except the author voted for ) accept it.
If the changes to the second PR / MR are based on outdated code, and the upper version in the main branch is different from the one on which the new changes are made, the web interface will report that the merge generates the conflicts you need:
- either locally when manually merging
- or ask the author of the code to
rebase a new version of the main branch, as a result the author of the new branch will solve the conflicts (therefore this is a more popular solution)
One variation of this process is called Github Flow .