lab 28 Distributed workflow (4/4)

Goals

Alex receives a pull request, and does the integration.

NOTE: This lab should be achieved by Alex.

Pulling the contribution 01

Alex has received a pull request for the new "hello" feature. Instead of pulling it directly into her/his private master branch, she/he will do it in a dedicated branch. That way, if the resolution of the conflicts which may arise produces some mess, Alex will have the possibility to work on it in a separate branch.

Execute:

cd tp-git
git checkout master
git checkout -b hello

Alex pulls the (remote) hello feature in her/his current branch.

Execute:

git pull dany hello

Output:

$ git pull dany hello
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From https://gitlab.ecole.ensicaen.fr/dany/tp-git-bis
 * branch            hello      -> FETCH_HEAD
 * [new branch]      hello      -> dany/hello
Updating 010db3f..1494b94
Fast-forward
 main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
$

A pull is basically a merge of the remote branch into the current one. Here, there was no conflict during the merge. If there was some, Alex would have to resolve the conflict before committing.

In this example, Alex may simply merge the local hello branch into the master branch (which is again done by a simple Fast-forward merge) before pushing the resulting master branch onto the official repository.

Pushing to the official repository 02

First Alex updates her/his private master branch with the hello commits.

Execute:

git checkout master
git merge hello

Output:

$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
$ git merge hello
Updating 010db3f..1494b94
Fast-forward
 main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
$

Then, Alex updates the official repository with a push.

Execute:

git push origin master

Output:

$  git push origin master
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 328 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@gitlab.ecole.ensicaen.fr:fourey/tp-git.git
   010db3f..1494b94  master -> master
$

Alex may now notify everyone that the "hello" feature has entered the official repository. All the developers should then synchronize their private master branches with the official one.

Developers (e.g. Dany) execute:

git checkout master
git pull upstream master

Table of Contents