Skip to content
Snippets Groups Projects
bhn_mkd.md 16.1 KiB
Newer Older
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
# Cours Forge ZZ2 F2 2017

# Infos étudiant :

 * BOUHANNI Hamza
 * EL MKOUDI Anass


## 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
$mkdir myRepo
$ cd myRepo/
$ git init

Initialized empty Git repository in H:/TPs/gdp/myRepo/.git/

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.md


$ git commit -m "ajout de l enonce du TP1"
[master (root-commit) 7796961] ajout de l enonce du TP1
 Committer: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 158 insertions(+)
 create mode 100644 tp1.md


0. Afficher la status de votre copie de travail

$ 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:   tp1.md

no changes added to commit (use "git add" and/or "git commit -a")

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 commit -m "Q5 MAJ-CR"
[master 8e9b215] Q5 MAJ-CR
 Committer: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 41 insertions(+), 80 deletions(-)

0. Afficher l'historique de votre repo

$ git log
commit 8e9b2157b67076d62c0143692f30d0ca28d1ab65 (HEAD -> master)
Author: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Date:   Mon Jan 8 18:32:51 2018 +0100

    Q5 MAJ-CR

commit 7796961e8665c25caadcac3abb22e04f6b8b39ef
Author: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Date:   Mon Jan 8 18:19:44 2018 +0100

    ajout de l enonce du TP1


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) `*`

anelmkoudi@A210PC07 MINGW64 /h/TPs/gdp/myRepo (master)
$ mv tp1.md bouhanni_elmkoudi.md

anelmkoudi@A210PC07 MINGW64 /h/TPs/gdp/myRepo (master)
$ git commit -am " Q 6 renommage du fichier"
[master 081c108]  Q 6 renommage du fichier
 Committer: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 119 deletions(-)
 delete mode 100644 tp1.md

 $ mv bouhanni_elmkoudi.md bhn_mkd.md

anelmkoudi@A210PC07 MINGW64 /h/TPs/gdp/myRepo (master)
$ git commit --amend -am " Q 6  deuxieme renommage du fichier"
[master e9b6f78]  Q 6  deuxieme renommage du fichier
 Date: Mon Jan 8 18:38:25 2018 +0100
 Committer: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 119 deletions(-)
 delete mode 100644 tp1.md

anelmkoudi@A210PC07 MINGW64 /h/TPs/gdp/myRepo (master)



0. Afficher l'historique de votre repo
$ git log
commit e9b6f7847a65f10f689a409023dcc1ae22084995 (HEAD -> master)
Author: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Date:   Mon Jan 8 18:38:25 2018 +0100

     Q 6  deuxieme renommage du fichier

commit 8e9b2157b67076d62c0143692f30d0ca28d1ab65
Author: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Date:   Mon Jan 8 18:32:51 2018 +0100

    Q5 MAJ-CR

commit 7796961e8665c25caadcac3abb22e04f6b8b39ef
Author: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Date:   Mon Jan 8 18:19:44 2018 +0100

    ajout de l enonce du TP1

0. Il ne devrait y avoir que deux entrées dans l'historique pourquoi ? `*`
on a ecrase le troisieme commit en utilisant l'option --amend.

0. Créer un nouveau fichier, nommé start, contenant la date et l'heure actuelle `*`
$ touch start.txt
$ echo "$(date)" > start.txt

$ git add start.txt
warning: LF will be replaced by CRLF in start.txt.
The file will have its original line endings in your working directory.

anelmkoudi@A210PC07 MINGW64 /h/TPs/gdp/myRepo (master)
$ git commit -m "Q10 ajout du fichier start"
[master bcd3b94] Q10 ajout du fichier start
 Committer: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 1 insertion(+)
 create mode 100644 start.txt


0. Créer un nouveau fichier : file2ignore
$touch 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)

        bhn_mkd.md
        file2ignore

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 `*`
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
$ touch .gitignore

anelmkoudi@A210PC07 MINGW64 /h/TPs/gdp/myRepo (master)
$ echo file2ignore > .gitignore


$ git add .
warning: LF will be replaced by CRLF in .gitignore.
The file will have its original line endings in your working directory.

anelmkoudi@A210PC07 MINGW64 /h/TPs/gdp/myRepo (master)
$ git commit -m "Q 13"
[master 118a83d] Q 13
 Committer: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 2 files changed, 253 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 bhn_mkd.md

EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
0. Lister le contenu du repertoire courant, afficher le status et la log
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed

$ ls
bhn_mkd.md  file2ignore  start.txt

anelmkoudi@A210PC07 MINGW64 /h/TPs/gdp/myRepo (master)
$ git status
On branch master
nothing to commit, working tree clean

anelmkoudi@A210PC07 MINGW64 /h/TPs/gdp/myRepo (master)
$ git log
commit 118a83dda7e1d1e88cb7b6015ddb874f1ebe443a (HEAD -> master)
Author: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Date:   Mon Jan 8 19:09:24 2018 +0100

    Q 13

commit bcd3b94d752f9423b7b7dda48f08ac6b49801e2c
Author: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Date:   Mon Jan 8 19:01:19 2018 +0100

    Q10 ajout du fichier start

commit e9b6f7847a65f10f689a409023dcc1ae22084995
Author: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Date:   Mon Jan 8 18:38:25 2018 +0100

     Q 6  deuxieme renommage du fichier

commit 8e9b2157b67076d62c0143692f30d0ca28d1ab65
Author: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Date:   Mon Jan 8 18:32:51 2018 +0100

    Q5 MAJ-CR

commit 7796961e8665c25caadcac3abb22e04f6b8b39ef
Author: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Date:   Mon Jan 8 18:19:44 2018 +0100

    ajout de l enonce du TP1

EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
0. Avant de commiter affichez les modifications par rapport à la précédente révision ? `*`

EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
$ git diff HEAD^ HEAD
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..92b7d53
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+file2ignore
diff --git a/bhn_mkd.md b/bhn_mkd.md
new file mode 100644
index 0000000..a7040b4
--- /dev/null
+++ b/bhn_mkd.md
@@ -0,0 +1,252 @@
+# Cours Forge ZZ2 F2 2017
+
+# Infos étudiant :
+
+ * BOUHANNI Hamza
+ * EL MKOUDI Anass
+
+
+## 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
+$mkdir myRepo
+$ cd myRepo/
+$ git init
+
+Initialized empty Git repository in H:/TPs/gdp/myRepo/.git/
+
+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.md
+
+
+$ git commit -m "ajout de l enonce du TP1"
+[master (root-commit) 7796961] ajout de l enonce du TP1
+ Committer: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
+Your name and email address were configured automatically based
+on your username and hostname. Please check that they are accurate.
+You can suppress this message by setting them explicitly. Run the
+following command and follow the instructions in your editor to edit
+your configuration file:
+
+    git config --global --edit
+
+After doing this, you may fix the identity used for this commit with:
+
+    git commit --amend --reset-author
+
+ 1 file changed, 158 insertions(+)
+ create mode 100644 tp1.md
+
+
+0. Afficher la status de votre copie de travail
+
+$ 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:   tp1.md
...





EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
##### 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`)
0. Lister les branches locales et les fichiers présent dans le répertoire courant `*`
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed

$ git branch
* Bouhanni
  master


EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
0. Aficher le status de votre repo `*`
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
$ git status
On branch Bouhanni
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:   bhn_mkd.md

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        bhn_mkd1.md

no changes added to commit (use "git add" and/or "git commit -a")


EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
0. Créez une branche pour _développer_ la réponse de ce point (nommez là `mybranch-2.4` par exemple)
  0. Afficher un historique sous forme de graph (`a dog`) de votre repo
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
  $ git log --all --graph --decorate --oneline
  * c3c948f (origin/myBranch) Q 2.3
  * 118a83d (HEAD -> Bouhanni, master, Bouhanni-2.4) Q 13
  * bcd3b94 Q10 ajout du fichier start
  * e9b6f78  Q 6  deuxieme renommage du fichier
  * 8e9b215 Q5 MAJ-CR
  * 7796961 ajout de l enonce du TP1





EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
  0. Pourquoi les 2 branches pointent elles sur la même révision ?`*`
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
  pas de difference entre les branches
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
  0. Afficher à nouvea l'historique pour montrer les modifications suite au précédent commit `*`
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
  $ git log --all --graph --decorate --oneline
  * 9982a9d (HEAD -> Bouhanni) Q 2.2
  | * c3c948f (origin/myBranch) Q 2.3
  |/
  * 118a83d (master, Bouhanni-2.4) Q 13
  * bcd3b94 Q10 ajout du fichier start
  * e9b6f78  Q 6  deuxieme renommage du fichier
  * 8e9b215 Q5 MAJ-CR
  * 7796961 ajout de l enonce du TP1

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
0. Revenir la brache `mybranch`
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed

EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
0. Où sont passé vos reponces au point 2.4 ? `*`
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
On a changé de branche, donc les reponses sont dans le fichier de la branche Bouhanni-2.4. il faut faire un merge pour mettre à jour le fichier
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
0. Affichez un historique sous forme de graph (`a dog`) de votre repo, Que peux ton en dire ?
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
$ git log --all --graph --decorate --oneline
* accb733 (Bouhanni-2.4) Q 2.5
| * 6fcb0bc (HEAD -> Bouhanni, origin/Bouhanni) fin de seance 2
| * 9982a9d Q 2.2
|/
| * c3c948f (origin/myBranch) Q 2.3
|/
* 118a83d (master) Q 13
* bcd3b94 Q10 ajout du fichier start
* e9b6f78  Q 6  deuxieme renommage du fichier
* 8e9b215 Q5 MAJ-CR
* 7796961 ajout de l enonce du TP1

EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
0. Revenir sur la branche master
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
$ git checkout master
Switched to branch 'master'

EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
0. Ajoutez et commitez un fichier (touch new_file)
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
touch new_file

$ git commit -m "Q 2.9"
[master 186250c] Q 2.9
 Committer: EL MKOUDI Anass <anelmkoudi@rcisima.isima.fr>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 new_file

EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
0. Revenir sur votre branche `mybranch` pour completer le compte rendu `*`
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
$ git commit -m "Q2.10"
On branch Bouhanni
nothing to commit, working tree clean

EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
0. Affichez un historique sous forme de graph (`a dog`) de votre repo `*`
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed
$ git log --all --graph --decorate --oneline
* 186250c (master) Q 2.9
| * accb733 (Bouhanni-2.4) Q 2.5
|/
| * 6fcb0bc (HEAD -> Bouhanni, origin/Bouhanni) fin de seance 2
| * 9982a9d Q 2.2
|/
| * c3c948f (origin/myBranch) Q 2.3
|/
* 118a83d Q 13
* bcd3b94 Q10 ajout du fichier start
* e9b6f78  Q 6  deuxieme renommage du fichier
* 8e9b215 Q5 MAJ-CR
* 7796961 ajout de l enonce du TP1
EL MKOUDI Anass's avatar
EL MKOUDI Anass committed

##### 3. Merge
0. Merge depuis head
  0. switcher sur une nouvelle branche `mybranch-3.1`
  0. ajout un nouveau fichier nommé easy_merge avec la date et l'heure actuelle `*`
  0. merger la branche `mybranch-4.1` sur `mybranch`
0. Afficher le status
0. Pourquoi n'y a t'il aucune modification en cours ? `*`
0. Affichez un historique sous forme de graph (`a dog`) de votre repo et décire l'état courant`*`
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)`*`
  0. Affichez un historique sous forme de graph (`a dog`) de votre repo `*`
0. Merge avec conflit
  0. Céer une nouvelle branche `mybranch-3.6`
  0. Notez dans le CR la date et l'heure actuelle (avec la commande `date` par exemple) `*`
  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.
0. Supprimer les branches de feature et afficher toutes les branches restantes, affichez un historique sous forme de graph (`a dog`) de votre repo `*`

##### 4. Remote
0. Afficher l'historique de votre repo
0. Ajouter le projet "2017-F2-Forge" comme repository distant `*`
0. Lister les branches distantes
0. Pousser votre branche de votre repo local sur le repos distant `*`
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 ?
0. Supprimer le dossier .git
0. Faire un git status ?