Git stash with staged files. Does stash convert staged files to unstaged?
I was working on a large set of changes to a code base. Some of the changes had been staged, and some had not. I needed to switch to a different branch, but was not ready to make a commit, so I stashed my current state using git stash
.
intended flow when git stash pop gets conflicts
I ran git stash pop
and got some conflicts. It’s a similar experience to conflicts from a rebase or merge, and I’ve been resolving them.
How to detect when git stash push reports “No local changes to save”?
I’m using git stash push -a
in a script to save uncommitted changes and then sometime later run git stash pop
in the same script to restore the stashed changes. I’ve run into a problem in which git stash push -a
occasionally reports “No local changes to save” and no no stash is created. This causes the subsequent git stash pop
to fail with exit code 1. Is there a way I can detect when git stash push -a
reports “No local changes to save” so that I know that no stash is created (short of checking the git stash push -a
output) and thus not perform the git stash pop
?
How to detect git stash “No local changes to save”?
I’m using git stash push -a
in a script to save uncommitted changes and then sometime later run git stash pop
in the same script to restore the stashed changes. I’ve run into a problem in which git stash push -a
occasionally reports “No local changes to save” and no no stash is created. This causes the subsequent git stash pop
to fail with exit code 1. Is there a way I can detect when git stash push -a
reports “No local changes to save” so that I know that no stash is created (short of checking the git stash push -a
output) and thus not perform the git stash pop
?