Git development
 help / color / mirror / Atom feed
From: Andreas Krey <a.krey@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: 'untracked working tree files would be overwritten by merge' on ignored files?
Date: Tue, 14 Jun 2016 23:35:08 +0200	[thread overview]
Message-ID: <20160614213508.GD30134@inner.h.apk.li> (raw)
In-Reply-To: <xmqqy467aeev.fsf@gitster.mtv.corp.google.com>

On Tue, 14 Jun 2016 10:06:16 +0000, Junio C Hamano wrote:
...
> 
> IIRC, untracked files are kept during merge and across checking out
> another branch.  Files that are deliberately marked as ignored by
> listing them to .gitignore mechanism are considered expendable, and
> they will be removed as necessary.

Apparently not. Waitaminute - I can check out the other branch,
and then the ignored file is replaced by the versioned file there,
as you say.

But when I try to merge the other branch, merge complains as in $subject.

That is, 'git merge other' does not work, but 'git checkout out;
git checkout -; git merge other' works because then the ignored file is
removed in the first checkout and no longer in the way for the merge:

    $ git status --ignored
    On branch side
    Ignored files:
      (use "git add -f <file>..." to include in what will be committed)

	    a.txt

    nothing to commit, working directory clean
    $ git merge master
    error: The following untracked working tree files would be overwritten by merge:
	    a.txt
    Please move or remove them before you can merge.
    Aborting
    $ git checkout master
    Switched to branch 'master'
    $ git checkout -
    Switched to branch 'side'
    $ git merge master
    Merge made by the 'recursive' strategy.
     a.txt | 1 +
     1 file changed, 1 insertion(+)
     create mode 100644 a.txt
    $

Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800

      reply	other threads:[~2016-06-14 21:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14 16:07 'untracked working tree files would be overwritten by merge' on ignored files? Andreas Krey
2016-06-14 17:06 ` Junio C Hamano
2016-06-14 21:35   ` Andreas Krey [this message]

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=20160614213508.GD30134@inner.h.apk.li \
    --to=a.krey@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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