... | ... | @@ -382,7 +382,9 @@ sebastienjean@MacBook-Air-749 gitlab-bases % |
|
|
|
|
|
## Synchronisation descendante d'un dépôt local
|
|
|
|
|
|
> ⚠️Pour simuler facilement l'existence de plusieurs développeurs, on réalise un clonage multiple du même dépôt en local, en configurant différemment les identités pour pouvoir s'y retrouver par la suite
|
|
|
### Préambule
|
|
|
|
|
|
> :warning:️Pour simuler facilement l'existence de plusieurs développeurs, on réalise un clonage multiple du même dépôt en local, en configurant différemment les identités pour pouvoir s'y retrouver par la suite
|
|
|
|
|
|
On supprime le contenu du dépôt local précédent :
|
|
|
|
... | ... | @@ -424,7 +426,7 @@ sebastienjean@MacBook-Air-749 clone1 % git config --local user.name |
|
|
dev1
|
|
|
```
|
|
|
|
|
|
On clone une seconde fois le dépôt, en configurant une identité particulière :
|
|
|
On clone une seconde fois le dépôt, en configurant une identité particulière (différente) :
|
|
|
|
|
|
```plaintext
|
|
|
sebastienjean@MacBook-Air-749 clone1 % cd ..
|
... | ... | @@ -439,4 +441,131 @@ Receiving objects: 100% (6/6), done. |
|
|
sebastienjean@MacBook-Air-749 clone2 % git config --local user.name dev2
|
|
|
sebastienjean@MacBook-Air-749 clone2 % git config --local user.name
|
|
|
dev2
|
|
|
```
|
|
|
|
|
|
### Synchronisation descendante, cas d'un retard simple
|
|
|
|
|
|
> 💡Ici, on traite le cas d'un développeur auquel il ne manquerait localement que des commits produits et envoyés sur le serveur par d'autres développeurs.
|
|
|
|
|
|
#### Validation d'une modification sur le `clone 1` et synchronisation montante avec le serveur
|
|
|
|
|
|
On se place dans le dépôt du `clone 1` :
|
|
|
|
|
|
```bash
|
|
|
sebastienjean@MacBook-Air-749 clone2 % cd ..
|
|
|
sebastienjean@MacBook-Air-749 gitlab-bases % cd clone1
|
|
|
sebastienjean@MacBook-Air-749 clone1 % ls -al
|
|
|
total 0
|
|
|
drwxr-xr-x 3 sebastienjean staff 96 Sep 25 12:05 .
|
|
|
drwxr-xr-x 4 sebastienjean staff 128 Sep 25 1b2:05 ..
|
|
|
drwxr-xr-x 5 sebastienjean staff 160 Sep 25 12:05 gitlab-bases
|
|
|
sebastienjean@MacBook-Air-749 clone1 % cd gitlab-bases
|
|
|
sebastienjean@MacBook-Air-749 gitlab-bases % ls -al
|
|
|
total 24
|
|
|
drwxr-xr-x 5 sebastienjean staff 160 Sep 25 12:05 .
|
|
|
drwxr-xr-x 3 sebastienjean staff 96 Sep 25 12:05 ..
|
|
|
drwxr-xr-x 12 sebastienjean staff 384 Sep 25 12:05 .git
|
|
|
-rw-r--r-- 1 sebastienjean staff 6223 Sep 25 12:05 README.md
|
|
|
-rw-r--r-- 1 sebastienjean staff 19 Sep 25 12:05 unFichier.txt
|
|
|
```
|
|
|
|
|
|
On ajoute une ligne de texte au fichier `unFichier.txt` :
|
|
|
|
|
|
```bash
|
|
|
sebastienjean@MacBook-Air-749 gitlab-bases % cat unFichier.txt
|
|
|
Une ligne de texte
|
|
|
sebastienjean@MacBook-Air-749 gitlab-bases % cat >> unFichier.txt
|
|
|
Une autre ligne de texte
|
|
|
sebastienjean@MacBook-Air-749 gitlab-bases % cat unFichier.txt
|
|
|
Une ligne de texte
|
|
|
Une autre ligne de texte
|
|
|
```
|
|
|
|
|
|
On vérifie l'état du dépôt :
|
|
|
|
|
|
```bash
|
|
|
sebastienjean@MacBook-Air-749 gitlab-bases % sebastienjean@MacBook-Air-749 gitlab-bases % git status
|
|
|
On branch main
|
|
|
Your branch is up to date with 'origin/main'.
|
|
|
|
|
|
Changes not staged for commit:
|
|
|
(use "git add <file>..." to update what will be committed)
|
|
|
(use "git restore <file>..." to discard changes in working directory)
|
|
|
modified: unFichier.txt
|
|
|
|
|
|
no changes added to commit (use "git add" and/or "git commit -a")
|
|
|
```
|
|
|
|
|
|
On valide localement la modification :
|
|
|
|
|
|
```bash
|
|
|
sebastienjean@MacBook-Air-749 gitlab-bases % git add unFichier.txt
|
|
|
sebastienjean@MacBook-Air-749 gitlab-bases % git status
|
|
|
On branch main
|
|
|
Your branch is up to date with 'origin/main'.
|
|
|
|
|
|
Changes to be committed:
|
|
|
(use "git restore --staged <file>..." to unstage)
|
|
|
modified: unFichier.txt
|
|
|
|
|
|
sebastienjean@MacBook-Air-749 gitlab-bases % git commit -m "ajout d'une ligne à unFichier.txt"
|
|
|
[main 9428a3d] ajout d'une ligne à unFichier.txt
|
|
|
1 file changed, 1 insertion(+)
|
|
|
```
|
|
|
|
|
|
On observe que la modification n'est pas encore synchronisée avec le serveur :
|
|
|
|
|
|
```bash
|
|
|
sebastienjean@MacBook-Air-749 gitlab-bases % git status
|
|
|
On branch main
|
|
|
Your branch is ahead of 'origin/main' by 1 commit.
|
|
|
(use "git push" to publish your local commits)
|
|
|
|
|
|
nothing to commit, working tree clean
|
|
|
sebastienjean@MacBook-Air-749 gitlab-bases % git log
|
|
|
commit 9428a3d9bac4b3c8ab7e95884e2387eef8c538c8 (HEAD -> main)
|
|
|
Author: sebastienjean <sebastien.jean@univ-grenoble-alpes.fr>
|
|
|
Date: Sun Sep 25 12:18:02 2022 +0200
|
|
|
|
|
|
ajout d'une ligne à unFichier.txt
|
|
|
|
|
|
commit 425ba5e6883161f2c01aba66e7279b4aabddb5e7 (origin/main, origin/HEAD)
|
|
|
Author: sebastienjean <sebastien.jean@univ-grenoble-alpes.fr>
|
|
|
Date: Sun Sep 25 09:37:30 2022 +0200
|
|
|
|
|
|
ajout d'un fichier
|
|
|
|
|
|
commit 23b7e5413195e7804fdd5bb7de4fb3efe1f63180
|
|
|
Author: Sebastien Jean <sebastien.jean@univ-grenoble-alpes.fr>
|
|
|
Date: Sun Sep 25 07:18:39 2022 +0000
|
|
|
|
|
|
Initial commit
|
|
|
```
|
|
|
|
|
|
On effectue une synchronisation ascendante (`push`) avec le serveur :
|
|
|
|
|
|
```bash
|
|
|
sebastienjean@MacBook-Air-749 gitlab-bases % git push
|
|
|
Enumerating objects: 5, done.
|
|
|
Counting objects: 100% (5/5), done.
|
|
|
Delta compression using up to 4 threads
|
|
|
Compressing objects: 100% (2/2), done.
|
|
|
Writing objects: 100% (3/3), 341 bytes | 341.00 KiB/s, done.
|
|
|
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
|
|
|
To https://gitlab.iut-valence.fr/jeans/gitlab-bases.git
|
|
|
425ba5e..9428a3d main -> main
|
|
|
```
|
|
|
|
|
|
On vérifie l'état du dépôt, qui confirme que la synchronisation a été correctement effectuée :
|
|
|
|
|
|
```plaintext
|
|
|
sebastienjean@MacBook-Air-749 gitlab-bases % git status
|
|
|
On branch main
|
|
|
Your branch is up to date with 'origin/main'.
|
|
|
|
|
|
nothing to commit, working tree clean
|
|
|
sebastienjean@MacBook-Air-749 gitlab-bases % git log --pretty="format:%h %s %an"
|
|
|
9428a3d ajout d'une ligne à unFichier.txt sebastienjean
|
|
|
425ba5e ajout d'un fichier sebastienjean
|
|
|
23b7e54 Initial commit Sebastien Jean
|
|
|
``` |
|
|
\ No newline at end of file |