3 ms·
I mostly only stash when I want to rebase -i because rebase -i seems to complain when I have uncommitted changes.
by chocolatebunny 10y ago
I mostly only stash when I want to rebase -i because rebase -i seems to complain when I have uncommitted changes.
- dahart 10y agoThat's a good example of what I'd consider to be a mildly unsafe use of stash, since if anything goes wrong you can lose unsaved changes. It's easier to forget what you're doing if you have merge conflicts during your rebase, or end up stashing something else while you rebase. The safer alternative workflow is: git commit -am "WIP" # Just throw your uncommitted changes into a commit git rebase -i origin/master # you might want to checkout my git rearrange command above git reset --soft HEAD^ # now un-stage your uncommitted changes and keep working The advantage of this is getting your uncommitted changes into a commit that can be easily recovered if anything goes wrong. Even though you get rid of the commit, this process is all stored in the reflog, and you can undo any of it easily and without resorting to fsck.
- __david__ 10y agoYou might check out "git rebase --autostash" if you haven't already.