mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
new function for git plugin: git_restore_file
This commit is contained in:
parent
43dcef1b07
commit
051c9ca5f8
1 changed files with 13 additions and 0 deletions
|
|
@ -153,3 +153,16 @@ function work_in_progress() {
|
|||
# these alias commit and uncomit wip branches
|
||||
alias gwip='git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m "wip"'
|
||||
alias gunwip='git log -n 1 | grep -q -c wip && git reset HEAD~1'
|
||||
|
||||
function git_restore_file() {
|
||||
if [ -z $1 ]; then
|
||||
echo 'filename required'
|
||||
return 1
|
||||
fi
|
||||
|
||||
local file=$1; shift
|
||||
|
||||
git checkout $(git rev-list -n 1 HEAD -- "$file")~1 -- "$file"
|
||||
|
||||
echo $file
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue