Skip to content

Commit

Permalink
git-checkout: allow pathspec to recover lost working tree directory
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Nov 15, 2006
1 parent 897643c commit bf7e147
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion git-checkout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ Did you intend to checkout '$@' which can not be resolved as commit?"
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
Expand Down

0 comments on commit bf7e147

Please sign in to comment.