Skip to content

Instantly share code, notes, and snippets.

@mhoyer
Last active October 16, 2016 11:21
Show Gist options
  • Save mhoyer/e821df0bc9921438028da2944d50bf1f to your computer and use it in GitHub Desktop.
Save mhoyer/e821df0bc9921438028da2944d50bf1f to your computer and use it in GitHub Desktop.
function stashed-git-command() {
if ! git diff --exit-code -s ; then
echo " >>> stashing"
git stash
stashpop=true
fi
$* && [ $stashpop ] && \
echo " <<< unstashing" && \
git stash pop
stashpop=
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment