Restores file that was deleted in a previous commit based on its last known state before it was removed.
### Git Unremove ## | |
# Adds an alias called "unrm" to retrieve a pile or path deleted at any point in the repositories history. | |
# Usage: | |
# git unrm [path] | |
# git unrm path/to/file | |
git config --global alias.unrm '!COMMIT=$(git log -1 --pretty=%h -- "$1"); git checkout $COMMIT^ -- "$1"; echo "File: $1, was restored from commit $COMMIT"; git show -s $COMMIT' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment