git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Grimm <koreth@midwinter.com>
To: git@vger.kernel.org
Subject: Directory in one branch, file in another = can't switch branches
Date: Fri, 16 Mar 2007 15:17:06 -0700	[thread overview]
Message-ID: <45FB1762.7040505@midwinter.com> (raw)

We've hit this problem with a git-svn-based repository where some stuff 
got reorganized, but it happens in plain git too; if you have a branch 
with a file called, say, "foo" and another branch with a file called 
"foo/bar", you can't switch between branches even if there are no 
uncommitted edits in either branch.

To reproduce (I'm using version 1.5.0.1.74.g2470):

% git init-db
Initialized empty Git repository in .git/
% echo "this is a test file" > testing
% git add testing
% git commit -a -m "initial commit on master"
Created initial commit 1a9cb1bf3a5475f0bb05d1e7c59839ba0a388be7
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 testing
% git checkout -b with-dir
Switched to a new branch "with-dir"
% mv testing testing-
% mkdir testing
% mv testing- testing/datafile
% git add testing/datafile
% git commit -a -m "commit with subdir"      
Created commit cdcb2af2a8dae8a2c5c3c143cb00b4863291cc17
 2 files changed, 1 insertions(+), 1 deletions(-)
 delete mode 100644 testing
 create mode 100644 testing/datafile
% git checkout master
fatal: Untracked working tree file 'testing' would be overwritten by merge.

You can work around it by renaming the directory, but git should really 
blow away the directory if it doesn't contain any untracked / modified 
files.

-Steve

             reply	other threads:[~2007-03-16 22:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-16 22:17 Steven Grimm [this message]
2007-03-16 22:59 ` Directory in one branch, file in another = can't switch branches Steven Grimm

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=45FB1762.7040505@midwinter.com \
    --to=koreth@midwinter.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).