added git plugin to restore deleted file

pull/1880/head
Gurkirat Singh 2021-05-04 23:30:39 +05:30
parent d3bb347786
commit e41286888c
No known key found for this signature in database
GPG Key ID: CFD64E1DCB3DA835
1 changed files with 11 additions and 0 deletions

View File

@ -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'