# cg switch -l doesn't work when branches point to the same commit

4 messages from 2007-07-11 to 2007-07-11. Participants: Bradford Smith, Alex Riesen, Sean, Bill Lear.
Thread: https://gitlist.dev/t/8982

## Bradford Smith, 2007-07-11 12:59

Subject: cg switch -l doesn't work when branches point to the same commit
Message-ID: <f158199e0707110559q43c290b4x2caee13cac46cf29@mail.gmail.com>
URL: https://gitlist.dev/e/f158199e0707110559q43c290b4x2caee13cac46cf29%40mail.gmail.com

```
The message below applies to software versions:

git version 1.4.4.2
cogito-0.18.2

Why doesn't cg switch -l save local changes when you switch to a
branch that points at the same commit you're already on?  Here's the
case I ran into.

1. On my master branch I was part of the way through making a fairly
complex change when I discovered an unrelated bug.  So, I wanted to:
     a. move my partial changes to a topical branch
     b. fix the bug on master
     c. finish my changes on the topical branch
     d. merge the topical branch back into master

2. I didn't really want to _commit_ my partial changes yet, though,
because I was really in mid-thought there, so I wanted to do it this
way:

# create the topical branch, carrying my local changes along with me
cg switch -c topical-branch
# switch back to master, leaving my local changes with the topical branch
cg switch -l master
# fix bug on master then
cg commit
# switch back to topical branch
cg switch topical-branch
# continue with changes and eventually
cg commit
cg switch master
cg merge topical-branch

Unfortunately, I found that 'cg switch -l master' did NOT save my
local changes.  I had to switch back to the branch, commit my partial
changes, then back to master to fix the bug.  So, I was able to work
around this, but I still found the behavior surprising.  If this is
expected behavior, shouldn't it be documented in the cg-switch man
page?

BTW, in a test repository/working directory I was able to confirm that
cg switch -l worked as documented when the two branches involved
pointed to different commits.

Thanks,

Bradford C. Smith

```

## Alex Riesen, 2007-07-11 13:36

Subject: Re: cg switch -l doesn't work when branches point to the same commit
Message-ID: <81b0412b0707110636u77b56f1biccb221489933972a@mail.gmail.com>
URL: https://gitlist.dev/e/81b0412b0707110636u77b56f1biccb221489933972a%40mail.gmail.com
In-Reply-To: <f158199e0707110559q43c290b4x2caee13cac46cf29@mail.gmail.com>

```
On 7/11/07, Bradford Smith <bradford.carl.smith@gmail.com> wrote:
> The message below applies to software versions:
>
> git version 1.4.4.2

It is fixed sometime between your version and git-1.5.2.2.
Use git checkout.

> cogito-0.18.2

Cogito is unmaintained ATM.

```

## Sean, 2007-07-11 20:34

Subject: Re: cg switch -l doesn't work when branches point to the same commit
Message-ID: <20070711163446.cb8d9c52.seanlkml@sympatico.ca>
URL: https://gitlist.dev/e/20070711163446.cb8d9c52.seanlkml%40sympatico.ca
In-Reply-To: <81b0412b0707110636u77b56f1biccb221489933972a@mail.gmail.com>

```
On Wed, 11 Jul 2007 15:36:39 +0200
"Alex Riesen" <raa.lkml@gmail.com> wrote:

> Cogito is unmaintained ATM.

Wonder who maintains the http://git.kernel.org site?  The front page
there still suggests the use of Cogito.

Sean

```

## Bill Lear, 2007-07-11 20:44

Subject: Re: cg switch -l doesn't work when branches point to the same commit
Message-ID: <18069.16677.594854.584712@lisa.zopyra.com>
URL: https://gitlist.dev/e/18069.16677.594854.584712%40lisa.zopyra.com
In-Reply-To: <20070711163446.cb8d9c52.seanlkml@sympatico.ca>

```
On Wednesday, July 11, 2007 at 16:34:46 (-0400) Sean writes:
>On Wed, 11 Jul 2007 15:36:39 +0200
>"Alex Riesen" <raa.lkml@gmail.com> wrote:
>
>> Cogito is unmaintained ATM.
>
>Wonder who maintains the http://git.kernel.org site?  The front page
>there still suggests the use of Cogito.

Petr Baudis, CCd here.


Bill

```
