3 ms·
My worst git disaster was when I attempted to, iirc, stash a half-completed merge. Maybe I tried to pop the stash; I can't really remember why this seemed like
by klyrs 4y ago
My worst git disaster was when I attempted to, iirc, stash a half-completed merge. Maybe I tried to pop the stash; I can't really remember why this seemed like a thing I should do. I've always felt like stash was made of gum and duct tape, and whatever sequence of operations I performed completely destroyed the repo. It's one of the very few times I've ever deleted the directory and started afresh, past the first few weeks of learning git.
Stash is effectively equivalent to
git switch -c stash-branch-$i
git commit -am stashed
git checkout $currentbranch
so I use that instead. Only instead of an anonymous name, I pick something sensible in case I get distracted and return to the work later. Also, it means I don't ever need to commit to the wrong branch -- `switch -c` carries uncommitted changes along. Sometimes cherrypick isn't a fine enough granularity, and I'll use difftool to distribute changes between two branches.