git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: file deletion in index lost after checkout -b

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 6, 2008, 18:10 UTC
Message-ID
<7vej3xrvqf.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20080906171108.GA10924@jabba.hq.digizenstudio.com>
Jing Xue <jingxue@digizenstudio.com> writes:
Show 5 quoted lines
> On Thu, Sep 04, 2008 at 11:12:26PM -0700, Junio C Hamano wrote:
>> [jc: please redirect an answer _meant for you_ off to the list with M-F-T header]
>
> I changed mutt to not use M-F-T with the git list at all. Hope this one
> turns out better.

Thanks; I meant to say "please do not redirect", but you got what I wanted to say correctly.

Show 18 quoted lines
>> > The deletion of 2.txt appears lost during 'checkout -b foo', while the
>> > modification and addition were both brought over. Is it a bug?
>> 
>> This behaviour is unchanged since early June 2005.
>> 
>>     http://thread.gmane.org/gmane.comp.version-control.git/4641/focus=4646
>> 
>> This is exactly the case marked as *0*, which both Linus and I said "it
>> feels somewhat wrong but otherwise we cannot start from an empty index".
>> 
>> We may want to do better this time around, though.
>
> I have since found out that:
>
> 1. file deletions in the working directory but not in index would not be forgotten. That
> makes "file deletions in index" case rather a corner one.
>
> 2. "checkout -b -m" would do the right thing.

Both correct. 1. does not involve case *0*; 2. does not do two-tree switch but internally uses three-tree switch and uses different codepath.

Previous: Jing XueNext: Junio C Hamano
Message 4 of 6 in “file deletion in index lost after checkout -b”
  1. Jing XueSep 1, 2008
  2. Junio C HamanoSep 5, 2008
  3. Jing XueSep 6, 2008
  4. Junio C HamanoSep 6, 2008
  5. Re* file deletion in index lost after checkout -bJunio C Hamano, Sep 8, 2008
  6. Jing XueSep 9, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.