Au-delà de git stash pop
Stash est plus capable que le simple save/pop que vous voyez d'habitude. Bien utilisé, c'est un brouillon personnel pour les changements de contexte qui surpasse de commiter du WIP dans la branche.
Sauvegarder avec intention
git stash push -m "WIP: refactor parser"
git stash push -m "config tweaks" -- src/config/
git stash push -k -m "sans staged"
git stash push -u -m "inclure untracked"
git stash push -a -m "inclure ignorés"
Lister et inspecter
git stash list
git stash show stash@{2}
git stash show -p stash@{2}
git diff stash@{0}^1 stash@{0}
Apply, pop, branch
git stash apply
git stash pop
git stash apply stash@{3}
git stash branch fix-bug stash@{1}
Stash partiel
git stash push -p
Résolution de conflits
git stash apply
git stash pop --index
Nettoyage
git stash drop stash@{4}
git stash clear
git reflog show stash
Cas d'usage : rebuild avant review
git stash push -u -m "feature WIP"
git checkout main && git pull
git switch -c ci-fix
# corriger + commit + push
git checkout feature
git stash pop
Erreurs courantes
Stasher avec des fichiers untracked mais sans -u. Traiter le stash comme stockage long terme.