Git stash seems to do a lot of what I want, except that it is a little hard to script, as the if you have no changes, then git stash; git stash pop
will do some
You should be using
git stash save
and not
git stash create
because this creates a stash (which is a regular commit object) and return its object name, without storing it anywhere in the ref namespace. Hence won't be accessible with stash apply.
Use git stash save "some comment"
is used when you have unstaged changes you wanna replicate/move onto another branch
Use git stash apply stash@{0}
(assuming your saved stash index is 0) when you want your saved(stashed) changes to reflect on your current branch
you can always use git stash list
to check all you stash indexes
and use git stash drop stash@{0}
(assuming your saved stash index is 0 and you wanna delete it) to delete a particular stash.