Relative Content

Tag Archive for gitgit-stash

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?