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
| # git-cof | |
| #!/bin/bash -e | |
| TMPFILE=`tempfile` | |
| [ -f .git/index ] || echo "${gitindex?Not a git repository?}" | |
| cp .git/index $TMPFILE | |
| GIT_INDEX_FILE=$TMPFILE git add . -u | |
| echo $(GIT_INDEX_FILE=$TMPFILE git write-tree) $(git whereami) $(git log -1 --oneline) >> .git/tree_backups | |
| git checkout -f "$@" | |
| rm $TMPFILE | |
| # git-foc | |
| #!/bin/bash | |
| TMPFILE=`tempfile` | |
| GIT_INDEX_FILE=$TMPFILE git read-tree $(echo $'$p\n$d\nwq' | ed -s .git/tree_backups | cut -d' ' -f1) | |
| GIT_INDEX_FILE=$TMPFILE git checkout -m . | |
| GIT_INDEX_FILE=$TMPFILE git reset HEAD | |
| rm $TMPFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment