Created
June 13, 2014 10:37
-
-
Save kipras/125b131699af2fd44534 to your computer and use it in GitHub Desktop.
git-stash-push
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# git-stash-push | |
# Push working tree onto the stash without modifying working tree. | |
# First argument (optional) is the stash message. | |
if [ -n "$1" ]; then | |
git update-ref -m "$1" refs/stash "$(git stash create \"$1\")" | |
else | |
HASH=`git stash create` | |
MESSAGE=`git log --no-walk --pretty="tformat:%-s" "$HASH"` | |
git update-ref -m "$MESSAGE" refs/stash "$HASH" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment