Information

Author(s) Mathieu Jadin
Deadline No deadline
Submission limit No limitation

Sign in

Git: Resolve conflicts

In the previous task, you merged your local history with the remote one with no conflicting changes.

Indeed, if you have two commits in different histories that modify the same line of a file, git is unable to figure out which version is the right one.

https://inginious.org/course/git/git-merge-conflict/git-before-pull-2.svg

Therefore, it will prepare a staging zone with the modifications without any conflict and and it will ask you to manually solve the remaining conflicts.

To help you, git writes in each conflicting file the conflicted lines, highlighted with <<<<<<<, ======= et >>>>>>>. First, it inserts the local version and then inserts the remote version. For instance:

<<<<<<< HEAD
Your local change
=======
The incompatible change on the remote copy
>>>>>>>

Once the conflicts are solved, you need to add the changes to the staging zone and the create the merge commit in the local copy:

https://inginious.org/course/git/git-merge-conflict/git-after-pull-2.svg

Finally, you may push your local history to the remote copy.

https://inginious.org/course/git/git-merge-conflict/git-after-push-2.svg

Download the archive which already contains a cloned repository in the subfolder clone. Synchronize it with its remote repository, and solve the conflict. The content of both commits must be merged together. Afterwards, zip the whole folder and upload it.

The message of the merge commit has to be "MERGE".

Note that the remote repository in this exercise is not on GitHub or Bitbucket but inside the folder bare.git of the archive.

Your submission needs to respect the following hierarchy:

git-merge-conflict/
├── bare.git/
|   └── [...]
└── clone/
    └── [...]

Max file size: 1.0 MiB
Allowed extensions: .zip