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

Checkout fails when one branch contains a directory with the name of a file in the other branch

From
TKTom Koelman <tkoelman@xs4all.nl>
Date
May 7, 2007, 11:07 UTC
Message-ID
<ubqgw51tf.fsf@assurancetourix.xs4all.nl>
Hi,

I am not sure whether this is intentional or not. I am wondering why this scenario fails, and if it is by design, how I should handle this situation:

-------------------------------------------------------------------------------- $ mkdir test

$ cd test

$ git init Initialized empty Git repository in .git/

$ echo aFile > aFile
$ git add aFile
$ git commit -m "initial"
Created initial commit a4aa48bb4ca57699341e380b17a1c3d92e44d08b
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 aFile

$ git checkout -b branch Switched to a new branch "branch"

$ git rm aFile rm 'aFile'

$ git commit -m "No aFile file anymore"
Created commit 6ac689ae4d7e8c0d82526d84563c12109b6cd900
 1 files changed, 0 insertions(+), 1 deletions(-)
 delete mode 100644 jacob
$ mkdir aFile
$ touch aFile/anotherFile
$ git add aFile/anotherFile 
$ git commit -m "added aFile directory"
Created commit 634e5fff2fdb6365d4be5b2dca29e9c78164cb07
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 aFile/anotherFile

$ git checkout master fatal: Untracked working tree file 'aFile' would be overwritten by merge. --------------------------------------------------------------------------------

Regards, Tom Koelman

Next: Johannes Schindelin
Message 1 of 4 in “Checkout fails when one branch contains a directory with the name of a file in the other branch”
  1. Tom KoelmanMay 7, 2007
  2. Johannes SchindelinMay 7, 2007
  3. Tom KoelmanMay 7, 2007
  4. Johannes SchindelinMay 7, 2007

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.