diff --git a/plugins/available/git.plugin.bash b/plugins/available/git.plugin.bash index e4efc3fe..01d7b930 100644 --- a/plugins/available/git.plugin.bash +++ b/plugins/available/git.plugin.bash @@ -37,6 +37,17 @@ function git_revert() { git reset --hard } + +function git_restore_file() { + about 'restore the deleted file from HEAD' + group 'git' + + [ -z $1 ] && return 1 + + COMMIT=$(git rev-list -n 1 HEAD -- "$1") + git checkout $COMMIT^ -- "$1" +} + function git_rollback() { about 'resets the current HEAD to this commit' group 'git'