Update Gestion de versions avec hébergement du dépôt sur un serveur GitLab, les bases authored by Sebastien Jean's avatar Sebastien Jean
...@@ -143,6 +143,9 @@ On observe alors que le dépôt lest bien présent localement (répertoire `.git ...@@ -143,6 +143,9 @@ On observe alors que le dépôt lest bien présent localement (répertoire `.git
``` ```
MacBook-Air-749:~ sebastienjean$ cd gitlab-bases/ MacBook-Air-749:~ sebastienjean$ cd gitlab-bases/
```
```
MacBook-Air-749:gitlab-bases sebastienjean$ ls -al MacBook-Air-749:gitlab-bases sebastienjean$ ls -al
total 8 total 8
drwxr-xr-x 4 sebastienjean staff 128 Jan 23 17:57 . drwxr-xr-x 4 sebastienjean staff 128 Jan 23 17:57 .
...@@ -219,8 +222,14 @@ On crée un nouveau fichier `unFichier.txt` à la racine du _Working Tree_ (et i ...@@ -219,8 +222,14 @@ On crée un nouveau fichier `unFichier.txt` à la racine du _Working Tree_ (et i
```bash ```bash
sebastienjean@MacBook-Air-749 gitlab-bases % cat > unFichier.txt sebastienjean@MacBook-Air-749 gitlab-bases % cat > unFichier.txt
Une ligne de texte Une ligne de texte
```
```
sebastienjean@MacBook-Air-749 gitlab-bases % ls sebastienjean@MacBook-Air-749 gitlab-bases % ls
README.md unFichier.txt README.md unFichier.txt
```
```
sebastienjean@MacBook-Air-749 gitlab-bases % cat unFichier.txt sebastienjean@MacBook-Air-749 gitlab-bases % cat unFichier.txt
Une ligne de texte Une ligne de texte
``` ```
...@@ -229,6 +238,9 @@ On valide une nouvelle version incluant ce fichier : ...@@ -229,6 +238,9 @@ On valide une nouvelle version incluant ce fichier :
``` ```
sebastienjean@MacBook-Air-749 gitlab-bases % git add unFichier.txt sebastienjean@MacBook-Air-749 gitlab-bases % git add unFichier.txt
```
```
sebastienjean@MacBook-Air-749 gitlab-bases % git commit -m "ajout d'un fichier" sebastienjean@MacBook-Air-749 gitlab-bases % git commit -m "ajout d'un fichier"
[main 425ba5e] ajout d'un fichier [main 425ba5e] ajout d'un fichier
1 file changed, 1 insertion(+) 1 file changed, 1 insertion(+)
...@@ -344,7 +356,13 @@ A partir de cette étape, si on supprime complètement le dépôt local et que l ...@@ -344,7 +356,13 @@ A partir de cette étape, si on supprime complètement le dépôt local et que l
```bash ```bash
sebastienjean@MacBook-Air-749 gitlab-bases % cd .. sebastienjean@MacBook-Air-749 gitlab-bases % cd ..
```
```
sebastienjean@MacBook-Air-749 ~ % rm -rf gitlab-bases sebastienjean@MacBook-Air-749 ~ % rm -rf gitlab-bases
```
```
sebastienjean@MacBook-Air-749 ~ % git clone https://gitlab.iut-valence.fr/jeans/gitlab-bases.git sebastienjean@MacBook-Air-749 ~ % git clone https://gitlab.iut-valence.fr/jeans/gitlab-bases.git
Cloning into 'gitlab-bases'... Cloning into 'gitlab-bases'...
remote: Enumerating objects: 6, done. remote: Enumerating objects: 6, done.
...@@ -352,7 +370,13 @@ remote: Counting objects: 100% (6/6), done. ...@@ -352,7 +370,13 @@ remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (4/4), done. remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0 remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (6/6), done. Receiving objects: 100% (6/6), done.
```
```
sebastienjean@MacBook-Air-749 ~ % cd gitlab-bases sebastienjean@MacBook-Air-749 ~ % cd gitlab-bases
```
```
sebastienjean@MacBook-Air-749 gitlab-bases % ls -al sebastienjean@MacBook-Air-749 gitlab-bases % ls -al
total 24 total 24
drwxr-xr-x 5 sebastienjean staff 160 Sep 25 09:59 . drwxr-xr-x 5 sebastienjean staff 160 Sep 25 09:59 .
...@@ -360,6 +384,9 @@ drwxr-xr-x@ 157 sebastienjean staff 5024 Sep 25 09:59 .. ...@@ -360,6 +384,9 @@ drwxr-xr-x@ 157 sebastienjean staff 5024 Sep 25 09:59 ..
drwxr-xr-x 12 sebastienjean staff 384 Sep 25 09:59 .git drwxr-xr-x 12 sebastienjean staff 384 Sep 25 09:59 .git
-rw-r--r-- 1 sebastienjean staff 6223 Sep 25 09:59 README.md -rw-r--r-- 1 sebastienjean staff 6223 Sep 25 09:59 README.md
-rw-r--r-- 1 sebastienjean staff 19 Sep 25 09:59 unFichier.txt -rw-r--r-- 1 sebastienjean staff 19 Sep 25 09:59 unFichier.txt
```
```
sebastienjean@MacBook-Air-749 gitlab-bases % git log sebastienjean@MacBook-Air-749 gitlab-bases % git log
commit 425ba5e6883161f2c01aba66e7279b4aabddb5e7 (HEAD -> main, origin/main, origin/HEAD) commit 425ba5e6883161f2c01aba66e7279b4aabddb5e7 (HEAD -> main, origin/main, origin/HEAD)
Author: sebastienjean <sebastien.jean@univ-grenoble-alpes.fr> Author: sebastienjean <sebastien.jean@univ-grenoble-alpes.fr>
...@@ -372,12 +399,14 @@ Author: Sebastien Jean <sebastien.jean@univ-grenoble-alpes.fr> ...@@ -372,12 +399,14 @@ Author: Sebastien Jean <sebastien.jean@univ-grenoble-alpes.fr>
Date: Sun Sep 25 07:18:39 2022 +0000 Date: Sun Sep 25 07:18:39 2022 +0000
Initial commit Initial commit
```
```
sebastienjean@MacBook-Air-749 gitlab-bases % git status sebastienjean@MacBook-Air-749 gitlab-bases % git status
On branch main On branch main
Your branch is up to date with 'origin/main'. Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean nothing to commit, working tree clean
sebastienjean@MacBook-Air-749 gitlab-bases %
``` ```
## Synchronisation descendante d'un dépôt local ## Synchronisation descendante d'un dépôt local
...@@ -389,8 +418,15 @@ sebastienjean@MacBook-Air-749 gitlab-bases % ...@@ -389,8 +418,15 @@ sebastienjean@MacBook-Air-749 gitlab-bases %
On supprime le contenu du dépôt local précédent : On supprime le contenu du dépôt local précédent :
```bash ```bash
sebastienjean@MacBook-Air-749 gitlab-bases % rm -rf .git sebastienjean@MacBook-Air-749 gitlab-bases % rm * sebastienjean@MacBook-Air-749 gitlab-bases % rm -rf .git
```
```
sebastienjean@MacBook-Air-749 gitlab-bases % rm *
zsh: sure you want to delete all 2 files in /Users/sebastienjean/gitlab-bases [yn]? y zsh: sure you want to delete all 2 files in /Users/sebastienjean/gitlab-bases [yn]? y
```
```
sebastienjean@MacBook-Air-749 gitlab-bases % ls -al sebastienjean@MacBook-Air-749 gitlab-bases % ls -al
total 0 total 0
drwxr-xr-x 2 sebastienjean staff 64 Sep 25 11:53 . drwxr-xr-x 2 sebastienjean staff 64 Sep 25 11:53 .
...@@ -401,7 +437,13 @@ On crée deux sous-répertoires pour accueillir les clones : ...@@ -401,7 +437,13 @@ On crée deux sous-répertoires pour accueillir les clones :
```plaintext ```plaintext
sebastienjean@MacBook-Air-749 gitlab-bases % mkdir clone1 sebastienjean@MacBook-Air-749 gitlab-bases % mkdir clone1
```
```
sebastienjean@MacBook-Air-749 gitlab-bases % mkdir clone2 sebastienjean@MacBook-Air-749 gitlab-bases % mkdir clone2
```
```
sebastienjean@MacBook-Air-749 gitlab-bases % ls -al sebastienjean@MacBook-Air-749 gitlab-bases % ls -al
total 0 total 0
drwxr-xr-x 4 sebastienjean staff 128 Sep 25 11:53 . drwxr-xr-x 4 sebastienjean staff 128 Sep 25 11:53 .
...@@ -414,6 +456,9 @@ On clone une première fois le dépôt, en configurant une identité particuliè ...@@ -414,6 +456,9 @@ On clone une première fois le dépôt, en configurant une identité particuliè
```plaintext ```plaintext
sebastienjean@MacBook-Air-749 gitlab-bases % cd clone1 sebastienjean@MacBook-Air-749 gitlab-bases % cd clone1
```
```
sebastienjean@MacBook-Air-749 clone1 % git clone https://gitlab.iut-valence.fr/jeans/gitlab-bases.git sebastienjean@MacBook-Air-749 clone1 % git clone https://gitlab.iut-valence.fr/jeans/gitlab-bases.git
Cloning into 'gitlab-bases'... Cloning into 'gitlab-bases'...
remote: Enumerating objects: 6, done. remote: Enumerating objects: 6, done.
...@@ -421,6 +466,9 @@ remote: Counting objects: 100% (6/6), done. ...@@ -421,6 +466,9 @@ remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (4/4), done. remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0 remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (6/6), done. Receiving objects: 100% (6/6), done.
```
```
sebastienjean@MacBook-Air-749 clone1 % git config --local user.name dev1 sebastienjean@MacBook-Air-749 clone1 % git config --local user.name dev1
sebastienjean@MacBook-Air-749 clone1 % git config --local user.name sebastienjean@MacBook-Air-749 clone1 % git config --local user.name
dev1 dev1
...@@ -429,8 +477,10 @@ dev1 ...@@ -429,8 +477,10 @@ dev1
On clone une seconde fois le dépôt, en configurant une identité particulière (différente) : On clone une seconde fois le dépôt, en configurant une identité particulière (différente) :
```plaintext ```plaintext
sebastienjean@MacBook-Air-749 clone1 % cd .. sebastienjean@MacBook-Air-749 clone1 % cd ../clone2
sebastienjean@MacBook-Air-749 gitlab-bases % cd clone2 ```
```
sebastienjean@MacBook-Air-749 clone2 % git clone https://gitlab.iut-valence.fr/jeans/gitlab-bases.git sebastienjean@MacBook-Air-749 clone2 % git clone https://gitlab.iut-valence.fr/jeans/gitlab-bases.git
Cloning into 'gitlab-bases'... Cloning into 'gitlab-bases'...
remote: Enumerating objects: 6, done. remote: Enumerating objects: 6, done.
...@@ -438,6 +488,9 @@ remote: Counting objects: 100% (6/6), done. ...@@ -438,6 +488,9 @@ remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (4/4), done. remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0 remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (6/6), done. 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
sebastienjean@MacBook-Air-749 clone2 % git config --local user.name sebastienjean@MacBook-Air-749 clone2 % git config --local user.name
dev2 dev2
...@@ -445,21 +498,29 @@ dev2 ...@@ -445,21 +498,29 @@ dev2
### Synchronisation descendante, cas d'un retard simple ### 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. > :bulb: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 #### 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` : On se place dans le dépôt du `clone 1` :
```bash ```bash
sebastienjean@MacBook-Air-749 clone2 % cd .. sebastienjean@MacBook-Air-749 clone2 % cd ../clone1
sebastienjean@MacBook-Air-749 gitlab-bases % cd clone1 ```
```
sebastienjean@MacBook-Air-749 clone1 % ls -al sebastienjean@MacBook-Air-749 clone1 % ls -al
total 0 total 0
drwxr-xr-x 3 sebastienjean staff 96 Sep 25 12:05 . 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 4 sebastienjean staff 128 Sep 25 1b2:05 ..
drwxr-xr-x 5 sebastienjean staff 160 Sep 25 12:05 gitlab-bases 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 clone1 % cd gitlab-bases
```
```
sebastienjean@MacBook-Air-749 gitlab-bases % ls -al sebastienjean@MacBook-Air-749 gitlab-bases % ls -al
total 24 total 24
drwxr-xr-x 5 sebastienjean staff 160 Sep 25 12:05 . drwxr-xr-x 5 sebastienjean staff 160 Sep 25 12:05 .
...@@ -483,6 +544,13 @@ Une autre ligne de texte ...@@ -483,6 +544,13 @@ Une autre ligne de texte
On vérifie l'état du dépôt : On vérifie l'état du dépôt :
```
sebastienjean@MacBook-Air-749 gitlab-bases % git log --pretty="format:%h %s %an %D"
425ba5e ajout d'un fichier sebastienjean HEAD -> main, origin/main, origin/HEAD
23b7e54 Initial commit Sebastien Jean
sebastienjean@MacBook-Air-749 gitlab-bases %
```
```bash ```bash
sebastienjean@MacBook-Air-749 gitlab-bases % sebastienjean@MacBook-Air-749 gitlab-bases % git status sebastienjean@MacBook-Air-749 gitlab-bases % sebastienjean@MacBook-Air-749 gitlab-bases % git status
On branch main On branch main
...@@ -500,6 +568,9 @@ no changes added to commit (use "git add" and/or "git commit -a") ...@@ -500,6 +568,9 @@ no changes added to commit (use "git add" and/or "git commit -a")
```bash ```bash
sebastienjean@MacBook-Air-749 gitlab-bases % git add unFichier.txt sebastienjean@MacBook-Air-749 gitlab-bases % git add unFichier.txt
```
```
sebastienjean@MacBook-Air-749 gitlab-bases % git status sebastienjean@MacBook-Air-749 gitlab-bases % git status
On branch main On branch main
Your branch is up to date with 'origin/main'. Your branch is up to date with 'origin/main'.
...@@ -507,13 +578,21 @@ Your branch is up to date with 'origin/main'. ...@@ -507,13 +578,21 @@ Your branch is up to date with 'origin/main'.
Changes to be committed: Changes to be committed:
(use "git restore --staged <file>..." to unstage) (use "git restore --staged <file>..." to unstage)
modified: unFichier.txt 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 sebastienjean@MacBook-Air-749 gitlab-bases % git commit -m "Ajout d'une ligne à unFichier.txt"
[main 899b42b] Ajout d'une ligne à unFichier.txt
1 file changed, 1 insertion(+) 1 file changed, 1 insertion(+)
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
``` ```
On observe que la modification n'est pas encore synchronisée avec le serveur : On vérifie l'état du dépôt et on observe que la modification n'est pas encore synchronisée avec le serveur :
```bash ```bash
sebastienjean@MacBook-Air-749 gitlab-bases % git status sebastienjean@MacBook-Air-749 gitlab-bases % git status
...@@ -522,24 +601,14 @@ Your branch is ahead of 'origin/main' by 1 commit. ...@@ -522,24 +601,14 @@ Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits) (use "git push" to publish your local commits)
nothing to commit, working tree clean 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 ```
sebastienjean@MacBook-Air-749 gitlab-bases % git log --pretty="format:%h %s %an %D"
899b42b Ajout d'une ligne à unFichier.txt sebastienjean HEAD -> main
425ba5e ajout d'un fichier sebastienjean origin/main, origin/HEAD
23b7e54 Initial commit Sebastien Jean
sebastienjean@MacBook-Air-749 gitlab-bases %
``` ```
On effectue une synchronisation ascendante (`push`) avec le serveur : On effectue une synchronisation ascendante (`push`) avec le serveur :
...@@ -553,19 +622,46 @@ Compressing objects: 100% (2/2), done. ...@@ -553,19 +622,46 @@ Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 341 bytes | 341.00 KiB/s, done. Writing objects: 100% (3/3), 341 bytes | 341.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To https://gitlab.iut-valence.fr/jeans/gitlab-bases.git To https://gitlab.iut-valence.fr/jeans/gitlab-bases.git
425ba5e..9428a3d main -> main 425ba5e..899b42b main -> main
``` ```
On vérifie l'état du dépôt, qui confirme que la synchronisation a été correctement effectuée : On vérifie l'état du dépôt, qui confirme que la synchronisation a été correctement effectuée :
```plaintext ```bash
sebastienjean@MacBook-Air-749 gitlab-bases % git status sebastienjean@MacBook-Air-749 gitlab-bases % git status
On branch main On branch main
Your branch is up to date with 'origin/main'. Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean 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
```
sebastienjean@MacBook-Air-749 gitlab-bases % git log --pretty="format:%h %s %an %D"
899b42b Ajout d'une ligne à unFichier.txt sebastienjean HEAD -> main, origin/main, origin/HEAD
425ba5e ajout d'un fichier sebastienjean 425ba5e ajout d'un fichier sebastienjean
23b7e54 Initial commit Sebastien Jean 23b7e54 Initial commit Sebastien Jean
``` ```
#### Synchronisation descendante depuis le `clone 2`
On se place dans le dépôt du `clone 2` :
```plaintext
sebastienjean@MacBook-Air-749 gitlab-bases % cd ../../clone2
sebastienjean@MacBook-Air-749 clone2 % ls -al
total 0
drwxr-xr-x 3 sebastienjean staff 96 Sep 25 12:07 .
drwxr-xr-x 4 sebastienjean staff 128 Sep 25 12:05 ..
drwxr-xr-x 5 sebastienjean staff 160 Sep 25 12:07 gitlab-bases
```
```plaintext
sebastienjean@MacBook-Air-749 clone2 % cd gitlab-bases
sebastienjean@MacBook-Air-749 gitlab-bases % ls -al
total 24
drwxr-xr-x 5 sebastienjean staff 160 Sep 25 12:07 .
drwxr-xr-x 3 sebastienjean staff 96 Sep 25 12:07 ..
drwxr-xr-x 12 sebastienjean staff 384 Sep 25 12:07 .git
-rw-r--r-- 1 sebastienjean staff 6223 Sep 25 12:07 README.md
-rw-r--r-- 1 sebastienjean staff 19 Sep 25 12:07 unFichier.txt
```
\ No newline at end of file