My "oldest" stash in a project is something I need to re-apply from time to time. (Yes, there's a reason for this, and yes, it's terrible, but fixing the underlying issue would be more time-consuming than just using git stash
for now.)
However, the oldest stash has the highest number in the list, so I can't apply it without first using git stash list
to see what number it is.
Is there some way to make Git print the number of stashes it's currently holding, so that something like this would always print the last stash (in a shell supporting this kind of command-interpolation)?
git stash apply $(git stash <count-command>)
I realize I can use something like this:
git stash list | tail -1 | awk '{print $1}' | grep -oP '\d+'
...but that's pretty hideous, so I'd like to know if there's something simpler.