Directory in one branch, file in another = can't switch branches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]