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

'untracked working tree files would be overwritten by merge' on ignored files?

From
Andreas Krey <a.krey@gmx.de>
Date
Jun 14, 2016, 16:07 UTC
Message-ID
<20160614160720.GA22675@inner.h.apk.li>
Hi all,

when I have an ignored file in my workspace, is git then also assumed not to remove it in the course of a merge?

Shouldn't it then say that the file is ignored, as it does not show up in the untracked section of git status?

Regards, Andreas
PS: Test script (will remove anything named 'tst'):
    rm -rf tst
    mkdir tst
    cd tst || exit 1
    git init
    echo '*.txt' >.gitignore
    git add .
    git commit -m initial
    git checkout -b side
    git checkout -
    date >a.txt
    git add -f a.txt
    git commit -m 'new file'
    git checkout side
    git commit -m 'nix' --allow-empty
    touch a.txt
    git status --ignored    # Shows a.txt as ignored
    git merge master        # Will complain
    git version
-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800
Next: Junio C Hamano
Message 1 of 3 in “'untracked working tree files would be overwritten by merge' on ignored files?”
  1. Andreas KreyJun 14, 2016
  2. Junio C HamanoJun 14, 2016
  3. Andreas KreyJun 14, 2016

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.