# Using local trees and cogito

3 messages from 2005-06-16 to 2005-06-17. Participants: Jon Smirl, Jan Harkes, Matthias Urlichs.
Thread: https://gitlist.dev/t/956

## Jon Smirl, 2005-06-16 02:37

Subject: Using local trees and cogito
Message-ID: <9e473391050615193719d81951@mail.gmail.com>
URL: https://gitlist.dev/e/9e473391050615193719d81951%40mail.gmail.com

```
I took Jeff Garzik's scripts for managing multiple trees and reworked
them a little for cogito. I changed the names to something that makes
more sense to me, but what does everyone think? Or can cogito already
do this I just can't figure it out?

In my terminology forks are different tree heads in the same git tree
(local branches).

cg-fork fname -- make a new tree head from the current tree and switch to it.
cg-goto fname -- switch the current working tree to one of the forks.
cg-goto -- display the name of the current fork
cg-goto -l -- display the name of all forks
cg-diff fname -- diff the current working tree to a fork
cg-merge fname -- merge another fork into the current fork

I fixed goto to not jump if there are pending changes. Is there a
better way to do this?

Is fork a good name since branches refer to other git trees? I'm
somewhat confused about exactly what a branch consists of, it looks to
me like the path to another external tree.

I do find Jeff's work very useful since it allows me to keep twenty
patches in a single tree and jump between them. This is better than bk
where I had to keep multiple entire trees with a build in each of
them. This way I only rebuild the files that changed after a jump.

One problem I did notice is that if you add file in a fork and jump to
a fork without the file, it doesn't get removed. That's not a big
problem but it can be confusing.

-- 
Jon Smirl
jonsmirl@gmail.com

```

## Jan Harkes, 2005-06-16 16:39

Subject: Re: Using local trees and cogito
Message-ID: <20050616163907.GA26037@delft.aura.cs.cmu.edu>
URL: https://gitlist.dev/e/20050616163907.GA26037%40delft.aura.cs.cmu.edu
In-Reply-To: <9e473391050615193719d81951@mail.gmail.com>

```
On Wed, Jun 15, 2005 at 10:37:59PM -0400, Jon Smirl wrote:
> One problem I did notice is that if you add file in a fork and jump to
> a fork without the file, it doesn't get removed. That's not a big
> problem but it can be confusing.

I noticed the same thing and 'solved' it the following way,

After pointing the head at the new branch, instead of using,

    git-read-tree -m HEAD && checkout-cache -q -f -u -a

I use,

    git-diff-cache -R -p HEAD | git-apply --index

This simple reverse applies the differences between the previously
checked out tree and the branch we just switched to. Ofcourse the
cache/index has to be up to date before we switch between branches.

Jan

```

## Matthias Urlichs, 2005-06-17 11:57

Subject: Re: Using local trees and cogito
Message-ID: <pan.2005.06.17.11.57.23.864424@smurf.noris.de>
URL: https://gitlist.dev/e/pan.2005.06.17.11.57.23.864424%40smurf.noris.de
In-Reply-To: <20050616163907.GA26037@delft.aura.cs.cmu.edu>

```
Hi, Jan Harkes wrote:

> I use,
> 
>     git-diff-cache -R -p HEAD | git-apply --index
> 
> This simple reverse applies the differences between the previously
> checked out tree and the branch we just switched to. Ofcourse the
> cache/index has to be up to date before we switch between branches.

... except that this method fails to create intermediate dirctories.

fatal: unable to create file drivers/media/dvb/dibusb/Kconfig (No such file or directory)

Looks like a bug in git-apply.

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
Let us endeavor so to live that when we come to die even the undertaker will be
sorry.
		-- Mark Twain, "Pudd'nhead Wilson's Calendar"



```
