diff --git a/02_gitlab_depot_distant/07_02_issues.md b/02_gitlab_depot_distant/07_02_issues.md index 92c80ce583b1de440fea9fafa450daa5da531484..6de03f8af762b6c9f12c8533c243eef641ad9614 100644 --- a/02_gitlab_depot_distant/07_02_issues.md +++ b/02_gitlab_depot_distant/07_02_issues.md @@ -96,3 +96,13 @@ Sur le projet sur lequel vous avez été invité, proposez une nouvelle idée d' * des cases à cocher pour suivre l'avancement * Je m'assigne à l'*issue* * Je crée et j'attribue le label `nouvelle fonctionnalité` + +---vertical--- + +### Lien avec les commits + +* Mentionner un commit dans un ticket (ex. : « Le texte ajouté par commit 26171abf doit être complété... »). +* Lier un commit à un ticket par le message de commit (ex. : `Correction orthographique. #123`) +* Fermer un ticket par le message de commit (ex. : `Correction orthographique. fixes #123`) [mais aussi *fix*, *close*, *resolve*, *implement*...](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html) + +Note: fermer un ticket depuis le message de commit n'est possible que depuis la branche *main*. diff --git a/03_branches/06_00_branches_distantes.md b/03_branches/06_00_branches_distantes.md index 7ea02e28a27818b09a622364d3189f51199d5abf..99e0a03cec53304cc8364106c551bfdf73fa5457 100644 --- a/03_branches/06_00_branches_distantes.md +++ b/03_branches/06_00_branches_distantes.md @@ -1,3 +1,5 @@ ---slide--- # Gestion des branches distantes + +Branches présentes sur un dépôt distant (ex. : dans GitLab). diff --git a/03_branches/06_02_ligne_commande.md b/03_branches/06_02_ligne_commande.md index b94d90ca79fe2dc0a60150cf43438819dc3eccaf..c03763f7cbe98248f2fc44956e1f89a860f42468 100644 --- a/03_branches/06_02_ligne_commande.md +++ b/03_branches/06_02_ligne_commande.md @@ -7,21 +7,21 @@ ```sh # Récupérer une branche distante : -git branch -f local-patch-1 origin/remote-patch-1 +git fetch +git switch patch-1 # Récupérer les modifications de la branche distante : -git pull origin patch-1 -# ou -git pull origin local-patch-1:remote-patch-1 +git pull # Envoyer les modifications sur la branche distante : git push origin patch-1 -# ou -git push origin local-patch-1:remote-patch-1 # Supprimer une branche distante git push -d origin remote-patch-1 ``` avec `origin` l'alias du dépôt distant (par défaut). +NB : possibilité de renommer la branche. + +Note: `git pull` = `fetch + rebase ou merge` ---vertical--- ## Dans quelle branche suis-je ? diff --git a/03_branches/07_fusion.md b/03_branches/07_fusion.md index 456d14c9c3270517e6a913e59d205a7e93b9fcf6..cc877a8ae2fd4eb761f02fb81351a13ac1a3ed5a 100644 --- a/03_branches/07_fusion.md +++ b/03_branches/07_fusion.md @@ -3,6 +3,9 @@ # Fusion ## *merge* +---vertical--- + +## Graphe ```mermaid gitGraph @@ -25,31 +28,47 @@ gitGraph ---vertical--- +## Pratique dans GitLab + +GitLab permet de simplifier les étapes : + +1. créer des tickets +2. créer une demande de fusion avec branche depuis chaque ticket +3. récupérer la branche en local +4. faire les modifications, valider, pousser +5. depuis GitLab, accepter la demande de fusion + +---vertical--- + +## En ligne de commande + ```sh -git checkout -b issue-1 +git switch -c issue-1 vim mon_texte.txt -git commit -m "Correction de texte. Ticket #1" -git checkout main -git checkout -b hotfix +git commit -m "Correction de texte. Ticket #1" mon_texte.txt +# Travail urgent à réaliser +git switch main +git switch -c hotfix vim ma_config.xml -git commit -m "Correction urgente" +git commit -m "Correction urgente" ma_config.xml # lancement de tests => OK, fusionner -git checkout main +git switch main git merge hotfix git branch -d hotfix -git checkout issue-1 +# +git switch issue-1 vim mon_texte.txt -git commit -m "Correction de texte terminée. Ticket #1" -git checkout main +git commit -m "Correction de texte terminée. Ticket #1" mon_texte.txt +git switch main git merge issue-1 -# l’historique de développement a divergé. +# l’historique de développement a divergé => commit de merge. ``` ---vertical--- ## Apparition et gestion des conflits -En cas de modification différentes de la même partie du même fichier dans les deux branches, Git ne sera pas capable de réaliser proprement la fusion. +En cas de modifications différentes de la même partie du même fichier dans les deux branches, Git ne sera pas capable de réaliser proprement la fusion. ---vertical--- diff --git a/03_branches/09_prochaine_session.md b/03_branches/09_prochaine_session.md index b3c2f2c212aee9302eefb7c4646c3efb45c1d16e..491505375769e0fb34c712b79a57cce58c3f910d 100644 --- a/03_branches/09_prochaine_session.md +++ b/03_branches/09_prochaine_session.md @@ -1,3 +1,5 @@ ---slide--- # Prochaine session + +Quels sont vos besoins ?