From: demerphq <demerphq@gmail.com>
To: Git <git@vger.kernel.org>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Bogus error: Untracked working tree file '....' would be overwritten by merge. Aborting
Date: Tue, 16 Nov 2010 11:26:19 +0100 [thread overview]
Message-ID: <AANLkTinv7XsXNR2MMbaGAUo2=WgL6SEWkuzwGU_7YVn0@mail.gmail.com> (raw)
The error in the subject line is generated if one has a git repo
checked out to a commit that adds a new file and one does something
like:
git reset HEAD^
and then a merge operation that involves going forward onto or past HEAD.
Why is this error generated when the file is *exactly* the same as the
file that would overwrite it?
Obviously it makes sense to throw this error when data would be lost,
but when they are identical what is the point?
In my experience when this happens they are almost always identical,
and that this is one of the most common sources of frustration and in
my shop a real source of confusion for my colleagues.
I think fixing it to detect they are identical and ignore them when
they are would really improve things for the uninitiated.
The following demonstrates the problem:
$ mkdir exp
$ cd exp
$ git init
Initialized empty Git repository in /home/demerphq/exp/.git/
$ echo woohoo > t.txt
$ git add t.txt
$ git commit -m'add t.txt'
[master (root-commit) dbe3cec] add t.txt
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 t.txt
$ echo boohoo > b.txt
$ git add b.txt
$ git commit -m'add b.txt'
[master 15a72ea] add b.txt
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 b.txt
$ git checkout -b other
Switched to a new branch 'other'
$ git reset HEAD^
$ git merge master
Updating dbe3cec..a61413d
error: Untracked working tree file 'b.txt' would be overwritten by merge.
Are there any reasons why this cant be changed?
Cheers,
yves
--
perl -Mre=debug -e "/just|another|perl|hacker/"
next reply other threads:[~2010-11-16 10:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-16 10:26 demerphq [this message]
2010-11-16 10:38 ` Bogus error: Untracked working tree file '....' would be overwritten by merge. Aborting demerphq
2010-11-16 11:24 ` Nguyen Thai Ngoc Duy
2010-11-16 11:34 ` Nguyen Thai Ngoc Duy
2010-11-17 8:37 ` demerphq
2010-11-17 9:22 ` Ævar Arnfjörð Bjarmason
2010-11-17 8:46 ` Matthieu Moy
2010-11-17 9:33 ` Nguyen Thai Ngoc Duy
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='AANLkTinv7XsXNR2MMbaGAUo2=WgL6SEWkuzwGU_7YVn0@mail.gmail.com' \
--to=demerphq@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.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).