Wofur Stash da ist
git stash legt unversionierte Anderungen weg.
Die Grundlagen
git stash
git stash -u
git stash -a
git stash push -m "WIP login"
git stash list
git stash show stash@{0}
git stash show -p stash@{0}
Wiederherstellung
git stash pop
git stash apply stash@{2}
git stash drop stash@{0}
git stash clear
Partielles Stashen
git stash push -p
Stash auf einen anderen Branch
git stash branch new-branch stash@{0}
Haufige Fallstricke
- Untracked Dateien werden standardmassig nicht gestashed.
- Stashes uberleben Branches.
- Stashes sind lokal.
git stash clearist unwiderruflich.
Wenn Commits Stashes schlagen
git add -A && git commit -m "WIP"
git reset --soft HEAD^
Verlorene Stashes wiederherstellen
git fsck --no-reflog | awk '/dangling commit/ {print $3}'
git stash apply <sha>
Namensdisziplin
Immer -m mit einer Beschreibung ubergeben.