So far we have only made changes in separate files. However, it can happen that you have made changes to the same file with 2 people, and that a conflict occurs.
In the project folder, edit the text in hello.txt and push it to the remote repository:
Also edit the text of hello.txt in the project2 folder
We first pull before we can push
We get a merge conflict, because we changed the same file in both repositories. Now, we need to resolve this conflict before the rebase can continue.
Via git status you can request a list of the merge conflicts:
You will be notified that you are rebasing. At “Unmerged paths” you see the files that are in conflict. You must first resolve the conflict by editing the file before continuing with the rebase.
Open the txt-file in a text editor. You notice that the content from project and project2 is present:
Adjust the text to:
Add this to the rebase action and use the ‘continue’ flag
Now when you execute git status, you will see that you are on the main branch again, and you are 1 commit ahead of the remote:
Now you can push again to the remote
Execute git pull in the other folder so that both are synced again.