# Cours Forge ZZ2 F2 2017 # Infos étudiant : Par binôme Nom Prénom: * Walczyszyn Fabien * Bertoni Marion ## TP 1 Télécharger le sujet du TP à l'adresse suivante : https://gitlab.isima.fr/mazenovi/2017-F2-Forge #### 1. Les basiques 0. Créer un repository git git init 0. _Par la suite pensez à commiter votre compte rendu apres chaques étapes dont l'enoncé est terminé par `*`, pour les messages de commit vous pouvez utiliser les numéros des questions (Ex Q1.2 ici)_ 0. Ajouter le compte rendu dans le repo `*` $ git add tp1\ cpw.md 0. Afficher la status de votre copie de travail $ git status On branch master nothing to commit, working tree clean 0. Modifiez le CR pour supprimer la première partie et indiquez vos noms (n'oublier pas de faire un `git add` pour marque le fichier comme devant être ajouté) `*` $ git add tp1\ cpw.md $ git commit -m "suppression premiere partie" [master 8ea1747] suppression premiere partie 1 file changed, 8 insertions(+), 87 deletions(-) 0. Afficher l'historique de votre repo $ git log commit 8ea17476335ccafecafd53a80715de71d4b13b54 (HEAD -> master) Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 18:30:28 2018 +0100 suppression premiere partie commit a95c3e051181aa16b2a2e8bd95fb7c2c65a690d3 Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 18:21:02 2018 +0100 premier ajout 0. Renommer ce fichier en préfixant avec vos noms en amendant le commit précédent (`git commit -m "mon message"` pour indiquer le mesage de commit directement) `*` $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) renamed: tp1 cpw.md -> Bertoni Walczyszyn tp1 cpw.md $ git commit -a --amend -m"modification du nom" [master 4773e48] modification du nom Date: Mon Jan 8 18:30:28 2018 +0100 1 file changed, 8 insertions(+), 87 deletions(-) rename tp1 cpw.md => Bertoni Walczyszyn tp1 cpw.md (61%) 0. Afficher l'historique de votre repo $ git log commit 4773e48d22ecbca3b1d7e07ae3e6893fb1e7859b (HEAD -> master) Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 18:30:28 2018 +0100 modification du nom commit a95c3e051181aa16b2a2e8bd95fb7c2c65a690d3 Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 18:21:02 2018 +0100 premier ajout 0. Il ne devrait y avoir que deux entrées dans l'historique pourquoi ? `*` Le deuxième commit a été modifié, un nouveau commit n'a pas été créé pour le changement de nom du fichier. 0. Créer un nouveau fichier, nommé start, contenant la date et l'heure actuelle `*` $ git add * $ git commit -m "ajout fichier start" [master 39cc64e] ajout fichier start 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 start.txt 0. Créer un nouveau fichier : file2ignore 0. Afficher la status de votre copie de travail $ git status On branch master Untracked files: (use "git add <file>..." to include in what will be committed) file2ignore.txt nothing added to commit but untracked files present (use "git add" to track) 0. On souhaite que ce fichier soit ignoré et ne soit jamais commiter. Réalisez la configuration nécesaire pour que cette regle soit effective `*` $ touch .gitignore $ echo .gitignore > file2ignore.txt $ git add .gitignore warning: LF will be replaced by CRLF in .gitignore. The file will have its original line endings in your working directory. $ git commit -m "ajout .gitignore" [master b710486] ajout .gitignore 1 file changed, 1 insertion(+) create mode 100644 .gitignore 0. Lister le contenu du repertoire courant, afficher le status et la log $ ls -a ./ ../ .git/ .gitignore 'Bertoni Walczyszyn tp1 cpw.md' file2ignore.txt start.txt $ git status On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: Bertoni Walczyszyn tp1 cpw.md no changes added to commit (use "git add" and/or "git commit -a") $ git log commit 8d099642e935da8dfb10e45c15dfdeb6baf21718 (HEAD -> master) Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 18:53:56 2018 +0100 ajout .gitignore commit 39cc64eb63efc636e37df435d7f4fb1c1b8a769b Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 18:43:46 2018 +0100 ajout fichier start commit 4773e48d22ecbca3b1d7e07ae3e6893fb1e7859b Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 18:30:28 2018 +0100 modification du nom commit a95c3e051181aa16b2a2e8bd95fb7c2c65a690d3 Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 18:21:02 2018 +0100 premier ajout 0. Avant de commiter affichez les modifications par rapport à la précédente révision ? `*` $ git diff HEAD 39cc64 diff --git a/Bertoni Walczyszyn tp1 cpw.md b/Bertoni Walczyszyn tp1 cpw.md index 24d2b78..d503c57 100644 --- a/Bertoni Walczyszyn tp1 cpw.md +++ b/Bertoni Walczyszyn tp1 cpw.md @@ -52,12 +52,11 @@ https://gitlab.isima.fr/mazenovi/2017-F2-Forge renamed: tp1 cpw.md -> Bertoni Walczyszyn tp1 cpw.md - - $ git commit -a --amend -m"modification du nom" - [master 4773e48] modification du nom - Date: Mon Jan 8 18:30:28 2018 +0100 - 1 file changed, 8 insertions(+), 87 deletions(-) - rename tp1 cpw.md => Bertoni Walczyszyn tp1 cpw.md (61%) + $ git commit -a --amend -m"modification du nom" + [master 4773e48] modification du nom + Date: Mon Jan 8 18:30:28 2018 +0100 + 1 file changed, 8 insertions(+), 87 deletions(-) + rename tp1 cpw.md => Bertoni Walczyszyn tp1 cpw.md (61%) 0. Afficher l'historique de votre repo @@ -80,12 +79,81 @@ https://gitlab.isima.fr/mazenovi/2017-F2-Forge de nom du fichier. diff --git a/.gitignore b/.gitignore deleted file mode 100644 index eb0899c..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -file2ignore.txt ##### 2. Les branches 0. Créez une branche portant votre nom et basculer sur cette branche (dans la suite du TP cette branche est désignée par `mybranch`) $ git branch BertoniWalczyszyn 0. Lister les branches locales et les fichiers présent dans le répertoire courant `*` $ git branch BertoniWalczyszyn * master $ ls -a ./ ../ .git/ .gitignore 'Bertoni Walczyszyn tp1 cpw.md' file2ignore.txt start.txt 0. Aficher le status de votre repo `*` $ git status On branch master nothing to commit, working tree clean 0. Créez une branche pour _développer_ la réponse de ce point (nommez là `mybranch-2.4` par exemple) $ git branch BW-2.4 BertoniWalczyszyn * master 0. Afficher un historique sous forme de graph (`a dog`) de votre repo $ git log --all --decorate --oneline --graphhh * 88533e1 (BertoniWalczyszyn) derniere version * 113376e (origin/BertoniWalczyszyn) derniere version 08/01 | * 52f744d (HEAD -> BW-2.4, master) 19h32 | * ae1b0d7 branche créée |/ * 8d09964 ajout .gitignore * 39cc64e ajout fichier start * 4773e48 modification du nom * a95c3e0 premier ajout 0. Pourquoi les 2 branches pointent elles sur la même révision ?`*` Car aucune modification n'a encore été faite, aucun nouveau commit sur la nouvelle branche 0. Afficher à nouveau l'historique pour montrer les modifications suite au précédent commit `*` $ git log --all --decorate --oneline --graph * baf3847 (HEAD -> BW-2.4) creation branche BW-2.4 * 52f744d (master) 19h32 * ae1b0d7 branche créée | * 88533e1 (BertoniWalczyszyn) derniere version | * 113376e (origin/BertoniWalczyszyn) derniere version 08/01 |/ * 8d09964 ajout .gitignore * 39cc64e ajout fichier start * 4773e48 modification du nom * a95c3e0 premier ajout 0. Revenir la branche `mybranch` $ git checkout BertoniWalczyszyn Switched to branch 'BertoniWalczyszyn' 0. Où sont passées vos reponses au point 2.4 ? `*` elles ont disparu 0. Affichez un historique sous forme de graph (`a dog`) de votre repo, Que peux ton en dire ? 0. Revenir sur la branche master 0. Ajoutez et commitez un fichier (touch new_file) $ git commit -m "ajout new_file" [master 5b03c92] ajout new_file 2 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 new_file 0. Revenir sur votre branche `mybranch` pour completer le compte rendu `*` $ git checkout BertoniWalczyszyn Switched to branch 'BertoniWalczyszyn' 0. Affichez un historique sous forme de graph (`a dog`) de votre repo `*` $ git log --all --decorate --oneline --graph * 5b03c92 (master) ajout new_file | * 8e5667f (HEAD -> BertoniWalczyszyn) changement de branche | * 65e4aff mise a jour rapport | |\ | | * 52d300a (BW-2.4) changement de branche | | * baf3847 creation branche BW-2.4 | |/ |/| * | 52f744d 19h32 * | ae1b0d7 branche créée | * 88533e1 derniere version | * 113376e (origin/BertoniWalczyszyn) derniere version 08/01 |/ * 8d09964 ajout .gitignore * 39cc64e ajout fichier start * 4773e48 modification du nom * a95c3e0 premier ajout ##### 3. Merge 0. Merge depuis head 0. switcher sur une nouvelle branche `mybranch-3.1` $ git branch BW-3.1 $ git checkout BW-3.1 Switched to branch 'BW-3.1' 0. ajout un nouveau fichier nommé easy_merge avec la date et l'heure actuelle `*` touch easy_merge.txt echo "05/02/2018 18:06"> easy_merge.txt $ git commit -m "ajout fichier easy_merge.txt" [BW-3.1 3dd77e5] ajout fichier easy_merge.txt 1 file changed, 1 insertion(+) create mode 100644 easy_merge.txt 0. merger la branche `mybranch-4.1` sur `mybranch` $ git checkout master Switched to branch 'master' $ git merge BW-3.1 Auto-merging Bertoni Walczyszyn tp1 cpw.md CONFLICT (content): Merge conflict in Bertoni Walczyszyn tp1 cpw.md Automatic merge failed; fix conflicts and then commit the result. 0. Afficher le status $ git status On branch master You have unmerged paths. (fix conflicts and run "git commit") (use "git merge --abort" to abort the merge) Changes to be committed: new file: easy_merge.txt 0. Pourquoi n'y a t'il aucune modification en cours ? `*` Car tous les nouveaux fichiers ont été ajouter dans la branche 3.1 et un merge a été fait donc il ne sont plus a faire dans la branche master 0. Affichez un historique sous forme de graph (`a dog`) de votre repo et décire l'état courant`*` ``` $ git log --all --decorate --oneline --graph * a88b6c0 (HEAD -> master) après merge avec BW-3.1 |\ | * bc42d8f (BW-3.1) changement de branche | * 3dd77e5 ajout fichier easy_merge.txt | * 9e1a11d (origin/BertoniWalczyszyn, BertoniWalczyszyn) dernier version 29/01 | * 8e5667f changement de branche | * 65e4aff mise a jour rapport | |\ | | * 52d300a (BW-2.4) changement de branche | | * baf3847 creation branche BW-2.4 | * | 88533e1 derniere version | * | 113376e derniere version 08/01 * | | 5b03c92 ajout new_file | |/ |/| * | 52f744d 19h32 * | ae1b0d7 branche créée |/ * 8d09964 ajout .gitignore * 39cc64e ajout fichier start * 4773e48 modification du nom * a95c3e0 premier ajout La branche master est dans le même etat que la branche BW-3.1. Car Un merge a été fait (même si un commit a été fait pour ajouter les changement dans le rapport) ``` 0. Merge avec modifications 0. Mergez les modifications de la branche `mybranch-2.4` sur `mybranch` (`*echap* :wq *enter*` pour sauvegarder le message de commit et quitter)`*` $ git merge BW-2.4 Merge made by the 'recursive' strategy. start.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 0. Affichez un historique sous forme de graph (`a dog`) de votre repo `*` ``` * 51e7d1d (BW-3.6) gerge branch 'BW-2.4' into BertoniWalczyszyn |\ | * b2b020d (BW-2.4) modif start.txt | | * a88b6c0 (HEAD -> master) après merge avec BW-3.1 | | |\ | | | * bc42d8f (BW-3.1) changement de branche | | | * 3dd77e5 ajout fichier easy_merge.txt | |_|/ |/| | * | | 9e1a11d (origin/BertoniWalczyszyn) dernier version 29/01 * | | 8e5667f changement de branche * | | 65e4aff mise a jour rapport |\ \ \ | |/ / | * | 52d300a changement de branche | * | baf3847 creation branche BW-2.4 * | | 88533e1 derniere version * | | 113376e derniere version 08/01 | | * 5b03c92 ajout new_file | |/ | * 52f744d 19h32 | * ae1b0d7 branche créée |/ * 8d09964 ajout .gitignore * 39cc64e ajout fichier start * 4773e48 modification du nom * a95c3e0 premier ajout ``` 0. Merge avec conflit 0. Céer une nouvelle branche `mybranch-3.6` $ git branch BW-3.6 0. Notez dans le CR la date et l'heure actuelle (avec la commande `date` par exemple) date coucou 0. Switchez sur la nouvelle branche et modifiez la réponse précendante dans le CR avec le `*` 0. Réalisez le merge de la brache `mybranch-3.6` sur `mybranch`. Le prompt change, pourquoi ? Gerer le conflit et commiter. $ git merge BW-3.6 Auto-merging Bertoni Walczyszyn tp1 cpw.md CONFLICT (content): Merge conflict in Bertoni Walczyszyn tp1 cpw.md Automatic merge failed; fix conflicts and then commit the result. Le prompt change car il y a un conflit. Une partie du fichier a été modifié dans deux branches différentes et git ne sait pas laquelle des versions prendre. 0. Supprimer les branches de feature et afficher toutes les branches restantes, affichez un historique sous forme de graph (`a dog`) de votre repo `*` $ git branch -d BW-2.4 Deleted branch BW-2.4 (was b2b020d). $ git branch -D BW-3.6 Deleted branch BW-3.6 (was d8b89e9). $ git branch -D BW-3.1 Deleted branch BW-3.1 (was bc42d8f). ##### 4. Remote 0. Afficher l'historique de votre repo $ git log commit bb962d16a03681ccbd2b5e36a3326a8552b572e8 (HEAD -> BertoniWalczyszyn) Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Feb 5 19:12:25 2018 +0100 modif reponde 3.2 commit 5cc776848038545e74b0d98b6aa08617b6acb708 Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Feb 5 19:08:07 2018 +0100 ajout reponse 3.2 commit 2dc07ae0dc98476b18036f1b1df6beafa20163b7 Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Feb 5 19:04:57 2018 +0100 modif rapport commit f921f323c6c4c64cd767d66bd57f64ce8aa59cfa Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Feb 5 18:41:58 2018 +0100 modif rapport commit 51e7d1d451a9f4d5c8f4206a985c44d5595e2cda Merge: 9e1a11d b2b020d Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Feb 5 18:29:47 2018 +0100 gerge branch 'BW-2.4' into BertoniWalczyszyn merge avec branche BW-2.4 commit b2b020dd88a28b282680fed90358906d3bca8366 Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Feb 5 18:29:21 2018 +0100 modif start.txt commit 9e1a11da0e95007e7f89b480967710c5bea31894 (origin/BertoniWalczyszyn) Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 29 19:36:28 2018 +0100 dernier version 29/01 commit 8e5667fbfa101a329947edcdfcdc5df79165f44c Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 29 19:32:18 2018 +0100 changement de branche commit 65e4affd5674a40b9cc6120ecd54c81e204a2fe1 Merge: 88533e1 52d300a Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 29 19:28:11 2018 +0100 mise a jour rapport commit 52d300a2ac59749988cc54bacfa2cf59873e25c0 Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 29 19:23:37 2018 +0100 changement de branche commit baf38476b621b148cc0132c05f93719171796018 Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 29 19:20:38 2018 +0100 creation branche BW-2.4 commit 88533e156c2086a230bdd03e3d01af38b13d224f Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 29 19:01:26 2018 +0100 derniere version commit 113376eeadaa267b944db844395884145bc3a908 Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 19:35:59 2018 +0100 derniere version 08/01 commit 52f744d020b46a0cc5fd69899d0ce11937cd2549 Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 19:32:50 2018 +0100 19h32 commit ae1b0d7fb71da3285762bef7423e6da0dbf413ce Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 19:14:30 2018 +0100 branche créée commit 8d099642e935da8dfb10e45c15dfdeb6baf21718 Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 18:53:56 2018 +0100 ajout .gitignore commit 39cc64eb63efc636e37df435d7f4fb1c1b8a769b Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 18:43:46 2018 +0100 ajout fichier start commit 4773e48d22ecbca3b1d7e07ae3e6893fb1e7859b Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 18:30:28 2018 +0100 modification du nom commit a95c3e051181aa16b2a2e8bd95fb7c2c65a690d3 Author: bertoni <marion_bertoni@outlook.fr> Date: Mon Jan 8 18:21:02 2018 +0100 premier ajout 0. Ajouter le projet "2017-F2-Forge" comme repository distant `*` $ git remote add origin https://mabertoni1@gitlab.isima.fr/mazenovi/2017-F2-Forge.git 0. Lister les branches distantes $ git ls-remote From https://mabertoni1@gitlab.isima.fr/mazenovi/2017-F2-Forge.git e9a1711f5c99e98255583ae17b019e2da3e0d6d1 HEAD 9e1a11da0e95007e7f89b480967710c5bea31894 refs/heads/BertoniWalczyszyn d8b9671f9deef99011c42d6f7920ce37422f4a6b refs/heads/BeuvotMaleterre 6fcb0bc129b241986ac09c2fc9e4513644f1f25d refs/heads/Bouhanni 946f30d6e7ab408e0b978614bb90c1cff607d374 refs/heads/CogoniHenry 0bdae066686d3c4563e93ed194626a963fe38958 refs/heads/Delefosse e34fd8946ddae8cefd2901abb45274b254713f43 refs/heads/Drosne 2f245cc73a36b33e20214a70399c8b4b80c51dad refs/heads/Falletty_Mistral 31aa94c4b144d747c8600867acc22c48d98251a7 refs/heads/JeanCharles_Neboit d838eca89340454c07deec02bb2db722f2eb3ab4 refs/heads/MosnierDrosne 1e1d462519bd372201c52be6ef4e3dca263b1652 refs/heads/PiatJullien 397c47f633438542511bd60a808c49d757388ed1 refs/heads/SERRE_PRUNIER e9a1711f5c99e98255583ae17b019e2da3e0d6d1 refs/heads/Supports 5cfaa4f0d9b78041ee1fddfedc389941eed11e27 refs/heads/TP1-CR 7f76031026bddaf1d38881c7a8fb63ec39ef9898 refs/heads/che_sig b5ccc8078858232e7913b7b9587d4c78c51d8c86 refs/heads/che_sig-2.4 e6e363caec4b50ce5e5331e7fcf65ebf88eaab9c refs/heads/develop 5cfaa4f0d9b78041ee1fddfedc389941eed11e27 refs/heads/master c3c948fdb6761dd79c143d8650f6c276dbfdde0e refs/heads/myBranch 54d210cea3f1f98e2b03af5601883282a8b4ce52 refs/heads/neboit_cournut 2c846d01b561d226555d79c37688cf3507824a06 refs/heads/reda_youssef 50cf2cb9891866475f844ce7bb89ff84987f928e refs/heads/tjo-TP1 50cf2cb9891866475f844ce7bb89ff84987f928e refs/merge-requests/1/head 397c47f633438542511bd60a808c49d757388ed1 refs/merge-requests/2/head 5cfaa4f0d9b78041ee1fddfedc389941eed11e27 refs/merge-requests/3/head 0bdae066686d3c4563e93ed194626a963fe38958 refs/merge-requests/4/head 2c846d01b561d226555d79c37688cf3507824a06 refs/merge-requests/5/head d838eca89340454c07deec02bb2db722f2eb3ab4 refs/merge-requests/6/head 54d210cea3f1f98e2b03af5601883282a8b4ce52 refs/merge-requests/7/head 0. Pousser votre branche de votre repo local sur le repos distant `*` $ git push origin BertoniWalczyszyn Counting objects: 13, done. Delta compression using up to 4 threads. Compressing objects: 100% (10/10), done. Writing objects: 100% (13/13), 4.63 KiB | 592.00 KiB/s, done. Total 13 (delta 2), reused 0 (delta 0) remote: remote: To create a merge request for BertoniWalczyszyn, visit: remote: https://gitlab.isima.fr/mazenovi/2017-F2-Forge/merge_requests/new?merge_request%5Bsource_branch%5D=BertoniWalczyszyn remote: To https://gitlab.isima.fr/mazenovi/2017-F2-Forge.git * [new branch] BertoniWalczyszyn -> BertoniWalczyszyn 0. En consultant votre branche sous gitlab, vous devriez constaté que la date de modification du fichier start est plus acienne que celle de votre compte rendu, porquoi alors que le push de toute votre branche est faite en une seule fois ? La date de modification du fichier start correspond au dernier commit où il a été modifié et non au même moment que le rapport de tp. 0. Supprimer le dossier .git 0. Faire un git status ?