lab 27 Distributed workflow (3/4)

Goals

We will have Dany make a contribution.

NOTE: This lab should be achieved by Dany.

Dany works on a feature 01

The main idea in this workflow is for the developers to have their master branch synchronized with the official one, and to work locally on a dedicated feature branch. Eventually, a contribution is pushed on the developper's public repository so that the integrator may pull it.

Let's have Dany make a contribution to the project, say to add an "hello" feature. First, she/he has to retrieve (pull) a fresh master branch from the upstream repository (remember that Alex already pushed her/his first commit). Then Dany will create a new "hello" branch from this point of the project in her/his private repository.

Execute:

git pull upstream master
git checkout -b hello

Output:

$ git pull upstream master
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From https://gitlab.ecole.ensicaen.fr/fourey/tp-git
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> upstream/master
$ git checkout -b hello
Switched to a new branch 'hello'
$

Now, Dany makes her/his modification to the main.c file.

File: main.c

#include <stdio.h>
int main()
{
  printf("Hello world!\n");
  return 0;
}

Execute:

git add main.c
git commit -m 'Add an hello message'

Now, we will push the state of the "hello" branch on Dany's public repository.

Execute:

git push origin hello

Output:

$ git add main.c
$ git commit -m 'Add an hello message'
[hello 1494b94] Add an hello message
 1 file changed, 3 insertions(+), 1 deletion(-)
$ git push origin hello
Counting objects: 6, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (6/6), 560 bytes | 0 bytes/s, done.
Total 6 (delta 0), reused 0 (delta 0)
To git@gitlab.ecole.ensicaen.fr:dany/tp-git-bis.git
 * [new branch]      hello -> hello
$

Dany sends a pull request 02

Now that Dany has pushed her/his work in the hello branch on her/his public repository, she/he can send a pull request to Alex saying something like ``You may get that nice feature in the hello branch at:
https://gitlab.ecole.ensicaen.fr/dany/tp-git-bis.git''.
In our case, Alex has already setup this URL as a remote in her/his private repository.

Up next 03

Alex will integrate the new feature in the official repository.

Table of Contents