Permalink
Browse files

new function for git plugin: git_restore_file

  • Loading branch information...
1 parent 43dcef1 commit 051c9ca5f862823d524e24eafd25269695cbebfe @tinogomes committed Nov 12, 2013
Showing with 13 additions and 0 deletions.
  1. +13 −0 plugins/git/git.plugin.zsh
View
@@ -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
+}

0 comments on commit 051c9ca

Please sign in to comment.