The repository is a chain of commit beginning with your first commit.
The repository is a chain of commit beginning with your first commit.
...
@@ -277,7 +274,7 @@ You can navigate to a given point of the repository with the command `git checko
...
@@ -277,7 +274,7 @@ You can navigate to a given point of the repository with the command `git checko
```sh
```sh
git log
git log
cat data/number.txt
cat data/number.txt
git checkout 8afd9d3
git checkout 531019e
cat data/number.txt
cat data/number.txt
```
```
...
@@ -336,7 +333,7 @@ git lo
...
@@ -336,7 +333,7 @@ git lo
We are back at the leaf of the git repository.
We are back at the leaf of the git repository.
### Growing the repository tree
## Growing the repository tree
We only have one branch, the `master` branch in our repository.
We only have one branch, the `master` branch in our repository.
This mean that we only have one timeline in our history.
This mean that we only have one timeline in our history.
...
@@ -350,9 +347,9 @@ git lo
...
@@ -350,9 +347,9 @@ git lo
```
```
```sh
```sh
echo '1' > data/number.txt
echo '3' > data/number.txt
git add data/number.txt
git add data/number.txt
git commit -m "1: first commit in dev"
git commit -m "a3"
git lo
git lo
```
```
...
@@ -360,17 +357,18 @@ If we have two branches `dev` and `master`, it's hard to tell them apart (`maste
...
@@ -360,17 +357,18 @@ If we have two branches `dev` and `master`, it's hard to tell them apart (`maste
```sh
```sh
git co master
git co master
echo 'c' > data/letter.txt
echo 'b' > data/letter.txt
git add data/letter.txt
git add data/letter.txt
git commit -m "c: third commit in master"
git commit -m "b2"
git lo
git lo
```
```
Congratulation you have a fork in your git repository !
Congratulation you have a fork in your git repository !
Lets make another one called `dict` from the branch `master` where `data/letter.txt` contain the letter `d`.
Lets make another one called `dev2` from the branch `master` where `data/letter.txt` contain the letter `c`.
Then create the corresponding commit `c2`
### Merging branches
## Merging branches
When you are ready to incorporate your new code in your main branch you need to merge the branch containing the new code into your main branch.
When you are ready to incorporate your new code in your main branch you need to merge the branch containing the new code into your main branch.
You can merge branch with the command `git merge`.
You can merge branch with the command `git merge`.
...
@@ -383,12 +381,12 @@ git branch
...
@@ -383,12 +381,12 @@ git branch
git merge master
git merge master
```
```
Can we merge `master` into `dict` ?
Can we merge `master` into `dev2` ?
```sh
```sh
git co master
git co master
git branch
git branch
git merge dict
git merge dev2
```
```
There are three types of merge :
There are three types of merge :
...
@@ -419,13 +417,15 @@ git lo
...
@@ -419,13 +417,15 @@ git lo
```
```
The new commit is a `Merge` commit with the identifiers of its two ancestors.
The new commit is a `Merge` commit with the identifiers of its two ancestors.
Here, we didn't have any conflict: in the `dev` branch, we worked on the `data/numberber.txt` file while in the `master` branch, we worked on the `data/letter.txt` file.
Here, we didn't have any conflict: in the `dev` branch, we worked on the `data/number.txt` file while in the `master` branch, we worked on the `data/letter.txt` file.
Let's complicate things !
Let's complicate things !
Create a new commit in the `master` branch where the content of `data/letter.txt` is set to `e`.
Create a new commit `e3` in the `master` branch where the content of `data/letter.txt` is set to `e`.
Then create a new commit in the `dev` branch where the content of `data/letter.txt` is set to `f` and go back the the branch `master`.
Then create a new commit in the `dev` branch where the content of `data/letter.txt` is set to `f` and go back the the branch `master`.
```sh
```sh
git lt
git branch
git branch
git merge dev
git merge dev
git st
git st
...
@@ -449,11 +449,12 @@ git add data/letter.txt
...
@@ -449,11 +449,12 @@ git add data/letter.txt
git st
git st
git commit
git commit
git st
git st
git lt
```
```
You now, know how to deal with the different kind of merge
You now, know how to deal with the different kind of merge
## Part 2: Git togetherdata
# Part 2: Git together
We start by cloning an existing repository.
We start by cloning an existing repository.
`file_handle.py` is a small python script to handle the dating and the access to dated files in a format compatible with the [guide of good practices at the LBMC](http://www.ens-lyon.fr/LBMC/intranet/fichiers/bioinfo/good-practices.pdf).
`file_handle.py` is a small python script to handle the dating and the access to dated files in a format compatible with the [guide of good practices at the LBMC](http://www.ens-lyon.fr/LBMC/intranet/fichiers/bioinfo/good-practices.pdf).
...
@@ -644,9 +645,6 @@ git push perso
...
@@ -644,9 +645,6 @@ git push perso
You can see the graph of our modifications at the following address [http://gitlab.biologie.ens-lyon.fr/user_name/git_basis/network/master](http://gitlab.biologie.ens-lyon.fr/user_name/git_basis/network/master)
You can see the graph of our modifications at the following address [http://gitlab.biologie.ens-lyon.fr/user_name/git_basis/network/master](http://gitlab.biologie.ens-lyon.fr/user_name/git_basis/network/master)
# Part 2: Git Together
Branch management is at the heart of Git. These powerful mechanisms will help
Branch management is at the heart of Git. These powerful mechanisms will help
you to work in collaboration with others. For the second part of the TP you
you to work in collaboration with others. For the second part of the TP you
need to pair with someone else. We will refer to you as developer **W**
need to pair with someone else. We will refer to you as developer **W**