Perhaps I just need a tool to intercept this and backup the affected files somewhere. The files can be deleted after some time (a week? or never?). And when I regret doing resetting the files, I can just dig through the backup and try to find it.
Perhaps I just need a tool to intercept this and backup the affected files somewhere. The files can be deleted after some time (a week? or never?). And when I regret doing resetting the files, I can just dig through the backup and try to find it.
git discard bad-idea-didnt-work
Which creates a tag discarded-bad-idea-didnt-work, then resets back to the previous commit.I can still find and rescue the changes later by looking at my tags.
Others have suggested using the stash for this but I prefer to keep my stash stack free for shorter-term contexts, eg. if I'm halfway through something but need to go checkout another branch briefly.
I'm pretty sure most git users (who know what "git reset" is) don't realize this!
Stashes could be cleared using a cron job.
You can see a list of saved stashes and their indices with `git stash list`.
I've been using `git stash apply stash@{n}`, which works just fine, but the stash is then not removed from your list and results in clutter.
It does, but then, this is the git command-line interface. :)
My understanding is that the stash pop command is simply an apply plus the removal of the successfully applied stash. The man page reflects this. It does not pop everything above element in the list.