# Checking out a branch in another directory

2 messages from 2010-09-03 to 2010-09-03. Participants: Luben Tuikov, Jonathan Nieder.
Thread: https://gitlist.dev/t/24964

## Luben Tuikov, 2010-09-03 22:10

Subject: Checking out a branch in another directory
Message-ID: <800379.5243.qm@web31805.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/800379.5243.qm%40web31805.mail.mud.yahoo.com

```
I'd like to checkout a branch and work on it and so on, but *in another directory*.  I wasn't able to accomplish this with git clone, as I can see that refs/heads were NOT shared as also indicated by .git/config, local and/or shared.

Is there official tools to do this in master?

I basically want to eliminate having to do git-checkout <branch> and instead simply do a cd ../<branch>, but really have just a single history.

For the last 4 years, I've been using a home-brewed git-mkdir-of-branch.sh from a local branch, which basically creates a bunch of symlinks and then runs git-read-tree HEAD; git-checkout-index -u -q -f -a.

   Luben

```

## Jonathan Nieder, 2010-09-03 22:23

Subject: Re: Checking out a branch in another directory
Message-ID: <20100903222351.GA26237@burratino>
URL: https://gitlist.dev/e/20100903222351.GA26237%40burratino
In-Reply-To: <800379.5243.qm@web31805.mail.mud.yahoo.com>

```
Hi Luben,

Luben Tuikov wrote:

> For the last 4 years, I've been using a home-brewed
> git-mkdir-of-branch.sh from a local branch, which basically creates
> a bunch of symlinks and then runs git-read-tree HEAD;
> git-checkout-index -u -q -f -a.

You might like contrib/workdir/git-new-workdir (shipped in
/usr/share/doc/git by most distros).

An occasional topic has been how to integrate this functionality
into "git clone".  See [1], for example.

Good luck,
Jonathan

[1] http://thread.gmane.org/gmane.comp.version-control.git/150559/focus=151247

```
