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
```sh
git log
cat data/number.txt
git checkout 8afd9d3
git checkout 531019e
cat data/number.txt
```
...
...
@@ -336,7 +333,7 @@ git lo
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.
This mean that we only have one timeline in our history.
...
...
@@ -350,9 +347,9 @@ git lo
```
```sh
echo '1' > data/number.txt
echo '3' > data/number.txt
git add data/number.txt
git commit -m "1: first commit in dev"
git commit -m "a3"
git lo
```
...
...
@@ -360,17 +357,18 @@ If we have two branches `dev` and `master`, it's hard to tell them apart (`maste
```sh
git co master
echo 'c' > data/letter.txt
echo 'b' > data/letter.txt
git add data/letter.txt
git commit -m "c: third commit in master"
git commit -m "b2"
git lo
```
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.
You can merge branch with the command `git merge`.
...
...
@@ -383,12 +381,12 @@ git branch
git merge master
```
Can we merge `master` into `dict` ?
Can we merge `master` into `dev2` ?
```sh
git co master
git branch
git merge dict
git merge dev2
```
There are three types of merge :
...
...
@@ -419,13 +417,15 @@ git lo
```
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 !
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`.
```sh
git lt
git branch
git merge dev
git st
...
...
@@ -449,11 +449,12 @@ git add data/letter.txt
git st
git commit
git st
git lt
```
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.
`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
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
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**