gestion_configuration:git:branches
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
gestion_configuration:git:branches [2016/11/21 23:08] – [Merge du master à une branche] sgariepy | gestion_configuration:git:branches [2022/02/02 00:42] (Version actuelle) – modification externe 127.0.0.1 | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ====== | + | ====== |
+ | Lister les branches par ordre de date de commit: | ||
+ | |||
+ | $ git branch --sort=-committerdate | ||
+ | |||
+ | Lister les branches avec les commits: | ||
+ | |||
+ | $ git branch -vv | ||
====== Nouvelle branche ====== | ====== Nouvelle branche ====== | ||
- | $ git branch | + | $ git branch |
+ | |||
+ | Pousser | ||
+ | |||
+ | $ git push origin < | ||
+ | Aussi | ||
+ | $ git checkout -b newbranch origin/ | ||
====== Changer de branche ====== | ====== Changer de branche ====== | ||
- | $ git checkout | + | $ git checkout |
+ | Pour obtenir une branche qui n'est pas locale, mais sur le dépôt distant: | ||
+ | |||
+ | $ git checkout -b < | ||
+ | |||
+ | Retourner à la branche précédente: | ||
+ | |||
+ | $ git checkout - | ||
+ | ====== Liste des branches ====== | ||
+ | git branch -a | ||
====== Annuler les changements ====== | ====== Annuler les changements ====== | ||
Ligne 38: | Ligne 60: | ||
- Réparer les conflits s'il y a lieu. | - Réparer les conflits s'il y a lieu. | ||
- Faire un commit du merge. | - Faire un commit du merge. | ||
+ | |||
+ | ===== Annuler un merge ===== | ||
+ | |||
+ | |||
+ | $ git reset --hard HEAD | ||
+ | |||
+ | | ||
+ | $ git merge --abort | ||
+ | | ||
+ | [[https:// | ||
====== Renommer une branche ====== | ====== Renommer une branche ====== | ||
- '' | - '' | ||
+ | |||
+ | |||
+ | ===== Renommer une branche remote ===== | ||
+ | |||
+ | |||
+ | $ git branch new-branch-name origin/ | ||
+ | $ git push origin --set-upstream new-branch-name | ||
+ | $ git push origin : | ||
+ | | ||
+ | [[http:// | ||
====== Supprimer une branche ====== | ====== Supprimer une branche ====== | ||
Ligne 47: | Ligne 89: | ||
La branche " | La branche " | ||
- | - '' | + | - '' |
- '' | - '' | ||
+ | |||
+ | ====== Git Rebase ====== | ||
+ | |||
+ | La documentation officielle : [[https:// | ||
+ | |||
+ | Si on a une branche **develop** qui a branché de **master** et qu'on veut inclure les changements de **master** plus tard dans le temps, en étant sur **develop**, | ||
+ | |||
+ | $ git rebase master | ||
+ | $ git rebase master develop | ||
+ | |||
+ | |||
+ | ====== Squash ====== | ||
+ | |||
+ | On veut // | ||
+ | |||
+ | $ git merge-base develop < | ||
+ | |||
+ | La commande donne le SHA du nouveau commit. | ||
+ | |||
+ | $ git rebase -i < | ||
+ | |||
+ | Éditer le fichier en gardant le premier '' | ||
+ | |||
+ | $ git push -u origin < | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
gestion_configuration/git/branches.1479766102.txt.gz · Dernière modification : 2022/02/02 00:43 (modification externe)