Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- TMPREPO=/tmp/.${RANDOM}-git-test
- mkdir -p $TMPREPO
- cd $TMPREPO
- [ "$(uname -s)" == "Darwin" ] && __=''
- git init .
- echo "foobar" > foobar
- git add foobar
- git commit -m "Adding foobar"
- # Prepend 'bar' to file foobar and stage it
- sed -i $__ -e "1i\\
- bar
- " foobar
- git add foobar
- # Prepend 'foo' to file foobar and leave it unstaged
- sed -i $__ -e "1i\\
- foo
- " foobar
- # Now, there are both unstaged ('foo') AND staged ('bar') changes in foobar.
- # Let's stash the temporary work
- git stash save --keep-index "Temporary work ('foo')"
- # Unstash them and... BOOOM! It fails... :(
- git stash pop
- echo "----- foobar ------"
- cat foobar
- echo "----- foobar ------"
- rm -rf $TMPREPO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement