Rappel : 100 Commandes Git Essentielles
1. Configuration
git config --global user.name "Nom"
git config --global user.email "email@example.com"
git config --list
git config --global core.editor nano
git config --global color.ui auto
2. Initialisation et Clonage
git init
git clone https://url.com/repo.git
git clone --depth 1 url
git clone -b branche url
3. États des fichiers
git status
git diff
git diff --staged
git log
git log --oneline
git log --graph --all
git show
4. Ajouter et Commiter
git add fichier
git add .
git commit -m "Message"
git commit -am "Ajout + commit"
git reset HEAD fichier
git rm fichier
5. Branches
git branch
git branch nouvelle-branche
git checkout branche
git checkout -b nouvelle-branche
git merge branche
git branch -d branche
git branch -D branche
6. Rebaser
git rebase branche
git rebase -i HEAD~3
git rebase --continue
git rebase --abort
7. Remotes
git remote -v
git remote add origin url
git remote remove origin
git push origin branche
git push -u origin branche
git pull origin branche
8. Stash
git stash
git stash list
git stash apply
git stash drop
9. Tags
git tag
git tag v1.0
git tag -a v1.0 -m "Version 1.0"
git push origin v1.0
git tag -d v1.0
10. Historique et Annulation
git log --since="1 week ago"
git checkout commitID
git revert commitID
git reset --soft HEAD~1
git reset --mixed HEAD~1
git reset --hard HEAD~1
11. Autres utiles
git clean -fd
git blame fichier
git shortlog -sn
git archive -o fichier.zip HEAD
git cherry-pick commitID
git bisect start
git grep "mot-clé"
git reflog
git gc