# Re: [PATCH] Make "git checkout <branch> <path>" work when <path> is a directory.

4 messages from 2006-11-17 to 2006-11-17. Participants: Junio C Hamano, Michael K. Edwards.
Thread: https://gitlist.dev/t/43102

## Michael K. Edwards, 2006-11-17 05:49

Subject: [PATCH] Make "git checkout <branch> <path>" work when <path> is a directory.
Message-ID: <f2b55d220611162149m719079f3ubdaeac43fe9798cb@mail.gmail.com>
URL: https://gitlist.dev/e/f2b55d220611162149m719079f3ubdaeac43fe9798cb%40mail.gmail.com

```
This improves the workflow for, say, kernel subsystem backporting.

Signed-off-by: Michael K. Edwards <medwards-linux@gmail.com>
---
 git-checkout.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-checkout.sh b/git-checkout.sh
index dd47724..5866604 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -106,7 +106,8 @@ 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 -- "$@"
+	git-ls-files "$@" |
+	git-checkout-index -f -u --stdin
 	exit $?
 else
 	# Make sure we did not fall back on $arg^{tree} codepath
-- 

```

## Junio C Hamano, 2006-11-17 06:04

Subject: Re: [PATCH] Make "git checkout <branch> <path>" work when <path> is a directory.
Message-ID: <7vlkmavcai.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vlkmavcai.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <f2b55d220611162149m719079f3ubdaeac43fe9798cb@mail.gmail.com>

```
Thanks.

I think I sent out the same yesterday morning, though.

	Message-ID: <7vbqn8msuw.fsf@assigned-by-dhcp.cox.net>

The difference is that the one tries to catch misspelled <path>.


```

## Michael K. Edwards, 2006-11-17 06:18

Subject: Re: [PATCH] Make "git checkout <branch> <path>" work when <path> is a directory.
Message-ID: <f2b55d220611162218t3a752829hf922613c17fe326d@mail.gmail.com>
URL: https://gitlist.dev/e/f2b55d220611162218t3a752829hf922613c17fe326d%40mail.gmail.com
In-Reply-To: <7vlkmavcai.fsf@assigned-by-dhcp.cox.net>

```
Ah.  Missed that patch, which is indeed a superset of mine.  Looks
like you committed it on branch "next"; is that a personal
experimental branch, or the integration branch against which patches
should be generated?

Cheers,

```

## Junio C Hamano, 2006-11-17 08:15

Subject: Re: [PATCH] Make "git checkout <branch> <path>" work when <path> is a directory.
Message-ID: <7vd57mtrod.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vd57mtrod.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <f2b55d220611162218t3a752829hf922613c17fe326d@mail.gmail.com>

```
"Michael K. Edwards" <medwards.linux@gmail.com> writes:

> Ah.  Missed that patch, which is indeed a superset of mine.  Looks
> like you committed it on branch "next"; is that a personal
> experimental branch, or the integration branch against which patches
> should be generated?

Actually it is not pushed out anywhere yet but will appear on
both 'maint' and 'master' along with other post 1.4.4 fixes and
will be contained in the 1.4.4.1 maintenance release.

The role of each branch at my public repository is desribed in
this message:

	Message-ID: <7vk62qhy4k.fsf@assigned-by-dhcp.cox.net>
	http://article.gmane.org/gmane.comp.version-control.git/29951

In general, if your changes and fixes are applicable in
isolation to "master", it is most appropriate to send patches
against "master".  If you are following up a topic that is
cooking in "next" (or "pu"), then basing your patch on "master"
is obviously a bad idea and a patch that applies on "next" (or
"pu") would be more appropriate.  If you can make the patch
against the tip of the specific topic that would be even better
but it generally is more work for you, so I usually do not ask
that to contributors.



```
