Information

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

Sign in

Git: Merge branches

In the previous exercise, you learned how to create and work with different branches.

The main concept behind branches is to merge the modifications made in one branch into the main branches once you tested your changes.

https://inginious.org/course/git/git-branch-merge/git-before-merge.svg

The profile branch is ready to be merged with the master branch. To do so, you need to set yourself on the branch master (with checkout) and use the command git merge. The merging of two branches works similarly to a pull from the remote history. If there are no modifications on the master branch (as here), the pointer of the branch is just moved. If there are compatible modifications on the master branch, a merge commit is automatically created. If there are incompatible changes, the conflicts will have to be solved just as in the exercise on conflicts solving.

https://inginious.org/course/git/git-branch-merge/git-after-merge.svg

Then, as usual, you need to push the local history of the branch master to the remote history.

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

You have to use git merge <src-branch-name> on the destination branch.


Téléchargez l'archive qui contient déjà un repository cloné dans le sous-dossier clone. Votre repository est dans l'état décrit par la première image de l'énoncé. Arrangez-vous pour le faire passer dans l'état décrit par la dernière image.

Une fois que c'est fait, ré-archivez le dossier complet et uploadez-le.

Le message du commit de fusion devra être "MERGE".

Notez que le repository "distant" dans cet exercice n'est pas sur github ou dans bitbucket mais dans le dossier bare.git de l'archive.

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

Max file size: 1.0 MiB
Allowed extensions: .zip