Aide-mémoire des commandes Git
Référence rapide des commandes Git courantes, couvrant les bases, les branches, les dépôts distants, l'annulation et plus. 100 % gratuit, exécuté localement dans votre navigateur — rien n'est téléversé vers nos serveurs.
Basic
git init— Initialize a new repositoryCliquez pour copiergit clone <url>— Clone a remote repositoryCliquez pour copiergit status— Show working tree statusCliquez pour copiergit add <file>— Stage file(s) for commitCliquez pour copiergit add .— Stage all changesCliquez pour copiergit commit -m "msg"— Commit staged changesCliquez pour copiergit diff— Show unstaged changesCliquez pour copiergit diff --staged— Show staged changesCliquez pour copierBranch
git branch— List local branchesCliquez pour copiergit branch <name>— Create a new branchCliquez pour copiergit checkout <branch>— Switch to branchCliquez pour copiergit checkout -b <name>— Create & switch to branchCliquez pour copiergit switch <branch>— Switch to branch (new)Cliquez pour copiergit switch -c <name>— Create & switch (new)Cliquez pour copiergit merge <branch>— Merge branch into currentCliquez pour copiergit branch -d <name>— Delete a branchCliquez pour copiergit branch -m <old> <new>— Rename a branchCliquez pour copierRemote
git remote -v— List remote repositoriesCliquez pour copiergit remote add <name> <url>— Add a remoteCliquez pour copiergit fetch— Fetch from remoteCliquez pour copiergit pull— Fetch & mergeCliquez pour copiergit push— Push to remoteCliquez pour copiergit push -u origin <branch>— Push & set upstreamCliquez pour copiergit remote remove <name>— Remove a remoteCliquez pour copierUndo/Reset
git reset HEAD <file>— Unstage a fileCliquez pour copiergit checkout -- <file>— Discard working changesCliquez pour copiergit restore <file>— Discard working changes (new)Cliquez pour copiergit reset --soft HEAD~1— Undo last commit, keep stagedCliquez pour copiergit reset --mixed HEAD~1— Undo last commit, keep unstagedCliquez pour copiergit reset --hard HEAD~1— Undo last commit, discard allCliquez pour copiergit revert <commit>— Create undo commitCliquez pour copierStash
git stash— Stash current changesCliquez pour copiergit stash list— List stashesCliquez pour copiergit stash pop— Apply & remove latest stashCliquez pour copiergit stash apply— Apply latest stashCliquez pour copiergit stash drop— Remove latest stashCliquez pour copiergit stash push -m "msg"— Stash with a messageCliquez pour copierLog
git log— Show commit historyCliquez pour copiergit log --oneline— Compact commit historyCliquez pour copiergit log --graph— Graph of branchesCliquez pour copiergit log -n <count>— Show last N commitsCliquez pour copiergit show <commit>— Show commit detailsCliquez pour copiergit blame <file>— Line-by-line historyCliquez pour copierTag
git tag— List tagsCliquez pour copiergit tag <name>— Create lightweight tagCliquez pour copiergit tag -a <name> -m "msg"— Create annotated tagCliquez pour copiergit tag -d <name>— Delete a tagCliquez pour copiergit push origin --tags— Push tags to remoteCliquez pour copier