1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-06-09 22:45:59 +02:00
tldr/pages.fr/common/git-branch.md
2025-03-07 13:25:35 +02:00

32 lines
896 B
Markdown

# git branch
> Commande Git principale pour travailler avec des branches.
> Plus d'informations : <https://git-scm.com/docs/git-branch>.
- Liste toutes les branches (locale et distantes) :
`git branch {{[-a|--all]}}`
- Affiche le nom de la branche courante :
`git branch --show-current`
- Crée une nouvelle branche depuis le commit courant :
`git branch {{nom_de_branche}}`
- Crée une nouvelle branche depuis un commit en particulier :
`git branch {{nom_de_branche}} {{commit_hash}}`
- Renommer une branche (ne pas se trouver sur la branche pour le faire) :
`git branch {{[-m|--move]}} {{ancien_nom_de_branche}} {{nouveau_nom_de_branche}}`
- Supprimer un branche locale (ne pas se trouver sur la branche pour le faire) :
`git branch {{[-d|--delete]}} {{nom_de_branche}}`
- Supprimer une branche distante :
`git push {{nom_distant}} {{[-d|--delete]}} {{nom_de_branche_distante}}`