diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-07-31 11:38:03 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-07-31 11:38:03 +0200 |
commit | 8fc4fdce522bb67bdf72a1fb1961927eb3c26ddc (patch) | |
tree | 9a87ba69075c56a7e5f9f48d0c122e588312244e /git-stash | |
parent | f543788e5289f5b1254121c02116c75993ff7a87 (diff) | |
download | bin-8fc4fdce522bb67bdf72a1fb1961927eb3c26ddc.zip bin-8fc4fdce522bb67bdf72a1fb1961927eb3c26ddc.tar.gz |
add git-stash
Diffstat (limited to 'git-stash')
-rwxr-xr-x | git-stash | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/git-stash b/git-stash new file mode 100755 index 0000000..5fc028f --- /dev/null +++ b/git-stash @@ -0,0 +1,25 @@ +#! /bin/bash +# +# very clever trick found there https://github.com/sitaramc/git-notes/blob/master/2-command-line-usage/git-tasks.mkd +# +# initial values: R (repo), I (index), C (changed), and U (untracked) +# notation: repo contents/index contents/work tree contents +# +option=${1:-""} +if [ "$option" = "-u" ] ; then + echo -e "\033[0;31mgit un-stash\033[0m" + # now RICU/RICU/RICU + git reset --mixed HEAD^ # repo=index=R+I + # now RI/RI/RICU; moved HEAD and index back one step + git reset --soft HEAD^ + # now R/RI/RICU; moved HEAD back one more step +else + echo -e "\033[0;31mgit stash\033[0m" + # R/RI/RICU; start + git commit --allow-empty -m wip-index-state + # now RI/RI/RICU; pushed index onto repo + git add -A && git commit --allow-empty -m wip-worktree-state + # now RICU/RICU/RICU; pushed C/U files onto repo + # ... switch branch, work work work, commit ... + # now you want to get back to the saved state +fi |