git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org, Martin Waitz <tali@admingilde.org>
Subject: Re: git reset --hard not removing some files
Date: Fri, 02 Jun 2006 07:57:57 -0700	[thread overview]
Message-ID: <7vhd33d2q2.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0606010918060.5498@g5.osdl.org> (Linus Torvalds's message of "Thu, 1 Jun 2006 09:21:38 -0700 (PDT)")

Linus Torvalds <torvalds@osdl.org> writes:

> On Thu, 1 Jun 2006, Martin Waitz wrote:
>> 
>> I have the following problem:
>
> It's not a problem, it's a feature.
>...
> Those files were _never_ tracked.

I would agree in the reproduction recipe Martin gave there is no
problem but feature, but at the same time I suspect the recent
"reset --hard simplification" has introduced a true regression.

        $ mkdir test || exit
        $ cd test || exit
        $ git init-db
        defaulting to local storage area
        $ echo init >file0
        $ echo init >file1
        $ git add file0 file1
        $ git commit -m initial
        Committing initial tree de84dc367842fdbbb3acad3b3ed252f8c984296f
        $ git branch side
        $ rm -f file1
        $ echo second >file2
        $ git add file2
        $ git commit -a -m 'master adds file2 and deletes file1'
        $ git checkout side
        $ echo modified >file1
        $ git commit -a -m 'side edits file1'
        $ git checkout master
        $ ls
        file0  file2
        $ git pull . side
        Trying really trivial in-index merge...
        fatal: Merge requires file-level merging
        Nope.
        Merging HEAD with 7934c9c383f611cf2b9895a46cf95b815569beef
        Merging: 
        b684570dc1141552d0da950a18f2d84a3ffadbc1 master adds file2 and deletes file1 
        7934c9c383f611cf2b9895a46cf95b815569beef side edits file1 
        found 1 common ancestor(s): 
        598d6491f72b6057ca87683d43cf64b08d90ddaf initial 
        CONFLICT (delete/modify): file1 deleted in HEAD and modified in 7934c9c383f611cf2b9895a46cf95b815569beef. Version 7934c9c383f611cf2b9895a46cf95b815569beef of file1 left in tree. 

        Automatic merge failed; fix conflicts and then commit the result.
        $ git ls-files -u
        100644 b1b716105590454bfc4c0247f193a04088f39c7f 1	file1
        100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 3	file1
        $ ls
        file0  file1  file2
        $ git reset --hard
        $ ls
        file0  file1  file2

We used to remove file1 from the working tree in this case.  One
of the most important reason to use "git reset --hard" is to
recover from a conflicted, failed merge.  

Leaving file1 in the working tree around in this case has
unpleasant consequences.  After the above:

	$ git checkout side
	fatal: Untracked working tree file 'file1' would be overwritten by merge.

  parent reply	other threads:[~2006-06-02 14:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-01 16:00 git reset --hard not removing some files Martin Waitz
     [not found] ` <20060601121304.9bae1806.seanlkml@sympatico.ca>
2006-06-01 16:13   ` Sean
2006-06-01 17:21     ` Jakub Narebski
     [not found]       ` <20060601152152.35ce04a5.seanlkml@sympatico.ca>
2006-06-01 19:21         ` Sean
2006-06-02  8:16           ` Jakub Narebski
2006-06-01 16:21 ` Linus Torvalds
2006-06-02  9:37   ` Martin Waitz
     [not found]     ` <20060602060820.8eebe391.seanlkml@sympatico.ca>
2006-06-02 10:08       ` Sean
2006-06-02 14:17       ` Martin Waitz
2006-06-02 14:57   ` Junio C Hamano [this message]
2006-06-03  8:48     ` Junio C Hamano
2006-06-03 15:11       ` Linus Torvalds
2006-06-04  9:16     ` Martin Waitz
2006-06-04  9:31       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vhd33d2q2.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=tali@admingilde.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).