git-checkout: allow pathspec to recover lost working tree directory
Quoted 9 lines · Anand Kumria
Quoted 7 lines · Junio C Hamano
It is often wanted on the #git channel that this were to work to recover removed directory:
rm -fr Documentation
git checkout -- Documentation
git checkout HEAD -- Documentation ;# alternatively
Quoted 6 lines
Quoted 1 line
Now it does.
One thing I often seem to do is make some changes, test them out and remove the file if it wa a dead end and get my original back with 'cg-restore <file>'. Does this mean that the git equivalent will be 'git checkout -- <file>' as well?
Naming individual files has been supported for a long time. What this patch adds is an ability to name a whole directory to restore to the index state or a named commit state).
Quoted 7 lines · Junio C Hamano
git-checkout.sh +0
-0@@ -112,7 +112,11 @@ Did you intend to checkout '$@' which ca git-ls-tree --full-name -r "$new" "$@" | git-update-index --index-info || exit $?
git-checkout.sh Did you intend to checkout '$@' which ca · line 122
Quoted 10 lines
git-checkout.sh +5
-1fi - git-checkout-index -f -u -- "$@" + + # Make sure the request is about existing paths. + git-ls-files --error-unmatch -- "$@" >/dev/null || exit + git-ls-files -- "$@" | + git-checkout-index -f -u --stdin exit $? else # Make sure we did not fall back on $arg^{tree} codepath
Wouldn't it be better to fix git-checkout-index to checkout a whole directory if specified?
Signature · 4 lines
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1PATCH 1/1 git-checkout: allow pathspec to recover lost working tree directory
It is often wanted on the #git channel that this were to work to recover removed directory:
rm -fr Documentation
git checkout -- Documentation
git checkout HEAD -- Documentation ;# alternatively
Now it does.
---
* Back to fixing usability issues one at a time instead of throwing everything away with bathwater.
git-checkout.sh | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
git-checkout.sh +5 -1
@@ -112,7 +112,11 @@ Did you intend to checkout '$@' which ca git-ls-tree --full-name -r "$new" "$@" | git-update-index --index-info || exit $? fi - git-checkout-index -f -u -- "$@" + + # Make sure the request is about existing paths. + git-ls-files --error-unmatch -- "$@" >/dev/null || exit + git-ls-files -- "$@" | + git-checkout-index -f -u --stdin exit $? else # Make sure we did not fall back on $arg^{tree} codepath
Signature · 1 line
1.4.4
Quoted 8 lines · Junio C Hamano
It is often wanted on the #git channel that this were to work to recover removed directory:
rm -fr Documentation
git checkout -- Documentation
git checkout HEAD -- Documentation ;# alternativelyNow it does.
One thing I often seem to do is make some changes, test them out and remove the file if it wa a dead end and get my original back with 'cg-restore <file>'. Does this mean that the git equivalent will be 'git checkout -- <file>' as well?
Thanks,
Anand