git pull
git
Syntaxe
git pull [--rebase|--ff-only] [<remote> <branch>]Enchaîne fetch et merge, d'où les commits de fusion inattendus ; --rebase ou --ff-only les évite.
Options courantes
| Option | Signification |
|---|---|
| --rebase | replay your commits on top instead of merging |
| --ff-only | refuse if a merge commit would be needed |
| --no-rebase | merge, whatever pull.rebase says |
| --autostash | park local changes for the duration |
| --prune | drop tracking refs for deleted branches |
| --depth <n> | shallow pull |
Exemples
git pull --rebase origin mainbrings in server commits and puts yours on top
git pull --ff-onlyupdates only when nothing has to be merged
git pull --autostashpulls even with uncommitted changes in the way
Ce qui embrouille, c’est qu’annuler a plusieurs formes : déplacer là où pointe une branche n’est pas ajouter un commit qui l’inverse.
Comment lire
- Les crochets [ ] marquent une partie facultative.
- Les points de suspension … signifient qu’on peut en mettre plusieurs.
- Les options sont sensibles à la casse : sur certaines commandes, -r et -R ne font pas la même chose.
Questions fréquentes
Q. Que fait git pull ?
Enchaîne fetch et merge, d'où les commits de fusion inattendus ; --rebase ou --ff-only les évite.
Q. Comment l’écrire ?
git pull [--rebase|--ff-only] [<remote> <branch>] — les crochets marquent ce qui est facultatif.
Q. Combien d’options valent la peine ?
Il y en a 6 ici ; la liste complète est dans man git. Cette commande relève de git.
Commandes liées
page man: man git-pull