Skip to content

Instantly share code, notes, and snippets.

@pomeh
Last active June 13, 2024 11:53
Show Gist options
  • Save pomeh/fe177183da96f1357b2a7abf978a91f2 to your computer and use it in GitHub Desktop.
Save pomeh/fe177183da96f1357b2a7abf978a91f2 to your computer and use it in GitHub Desktop.
Multiples branches level for learngitbranching.js.org
{
"goalTreeString": "{\"branches\":{\"main\":{\"target\":\"C1\",\"id\":\"main\",\"remoteTrackingBranchID\":null},\"feat-auth\":{\"target\":\"C7\",\"id\":\"feat-auth\",\"remoteTrackingBranchID\":null},\"fix-cve42\":{\"target\":\"C3\",\"id\":\"fix-cve42\",\"remoteTrackingBranchID\":null},\"doc-ios\":{\"target\":\"C5\",\"id\":\"doc-ios\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C1\"],\"id\":\"C4\"},\"C5\":{\"parents\":[\"C4\"],\"id\":\"C5\"},\"C6\":{\"parents\":[\"C2\"],\"id\":\"C6\"},\"C7\":{\"parents\":[\"C6\"],\"id\":\"C7\"}},\"tags\":{},\"HEAD\":{\"target\":\"feat-auth\",\"id\":\"HEAD\"}}",
"solutionCommand": "git branch fix-cve42 v2;git branch doc-ios v3;git switch -c feat-auth v1;git branch -d v1 v2 v3;git commit;",
"startTree": "{\"branches\":{\"main\":{\"target\":\"C1\",\"id\":\"main\",\"remoteTrackingBranchID\":null},\"v1\":{\"target\":\"C6\",\"id\":\"v1\",\"remoteTrackingBranchID\":null},\"v2\":{\"target\":\"C3\",\"id\":\"v2\",\"remoteTrackingBranchID\":null},\"v3\":{\"target\":\"C5\",\"id\":\"v3\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C1\"],\"id\":\"C4\"},\"C5\":{\"parents\":[\"C4\"],\"id\":\"C5\"},\"C6\":{\"parents\":[\"C2\"],\"id\":\"C6\"}},\"tags\":{},\"HEAD\":{\"target\":\"main\",\"id\":\"HEAD\"}}",
"hint": {
"en_US": "test it",
"fr_FR": "Prenez le temps de faire les choses dans l'ordre. 1) créer les branches avec leurs nouveaux noms ('git branch'), 2) supprimer les anciennes branches ('git branch -d'), 3) se positionner sur la branche souhaitée ('git checkout'), et 4) ajouter le commit manquant sur la bonne branche ('git commit')"
},
"name": {
"en_US": "Multiple branches",
"fr_FR": "Multiples branches"
},
"startDialog": {
"fr_FR": {
"childViews": [
{
"type": "GitDemonstrationView",
"options": {
"beforeMarkdowns": [
"## Plusieurs branches",
"",
"Un dépôt peut avoir plusieurs branches. Pour s'y retrouver, il vaut mieux les nommer correctement.",
"",
"Ici, `edge` est mal écrit dans le nom de la branche.",
"",
"Pour la renommer, on peut créer une nouvelle branche, puis supprimer l'ancienne."
],
"afterMarkdowns": [
"Et voilà ! Problème réglé !",
"",
"Git permet d'utiliser `git branch --move`, mais ce n'est pas supporté dans cet outil."
],
"command": "git branch fix-edge fix-dege; git branch -d fix-dege",
"beforeCommand": "git switch -c fix-dege main ; git commit ; git switch main"
}
},
{
"type": "ModalAlert",
"options": {
"markdowns": [
"## A vous de jouer !",
"",
"J'ai par erreur créé plusieurs plusieurs branches `v1`, `v2` et `v3`, mais je n'arrive pas à me rappeler laquelle correspond à quel changement.",
"",
"Il faudrait renommer ces 3 branches respectivement en `feat-auth`, `fix-cve42` et `doc-ios`, tel qu'indiqué dans l'objectif sur la droite de l'écran.",
"",
"Maintenant, c'est à vous d'entrer en action !"
]
}
},
{
"type": "ModalAlert",
"options": {
"markdowns": [
"## Oups !",
"",
"Attendez ! J'ai aussi oublié de mettre commit dans la branche `feat-auth`. Quelle tête en l'air alors !",
"",
"Vous pouvez m'aider, pas vrai ?"
]
}
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment