Thread (18 messages) flat view 18 messages, 5 authors, 2016-06-15

Re: Untracked working tree files

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2016-06-15 22:45:29

On Wed, 15 Oct 2008 12:14:34 -0700 (PDT)
david@lang.hm wrote:
On Wed, 15 Oct 2008, david@lang.hm wrote:
quoted
On Wed, 15 Oct 2008, Andrew Morton wrote:
quoted
Date: Wed, 15 Oct 2008 11:56:54 -0700
From: Andrew Morton <akpm@linux-foundation.org>
To: git@vger.kernel.org
Subject: Untracked working tree files

I often get this (running git 1.5.6.rc0 presently):

y:/usr/src/git26> git-checkout linux-next
error: Untracked working tree file 'arch/x86/kernel/apic.c' would be 
overwritten by merge.

which screws things up.  I fix it by removing the offending file, which
gets irritating because git bails out after the first such instance, so
I need to rerun git-checkout once per file (there are sometimes tens of 
them).
what I do when I run into this is "git reset --hard HEAD" which makes all 
files in the working directory match HEAD, and then I can do the other 
checkout.
I do

	git-reset --hard HEAD
	git-reset --hard linux-next
	git-checkout linux-next

and get

error: Untracked working tree file 'Next/SHA1s' would be overwritten by merge.
y

grr.
I think you can also do git checkout -f head to force the checkout to 
overwrite all files
yup, that fixed it.  whee, thanks.
the fact that git will happily leave modified things in the working 
directory appears to be very helpful for some developers, but it's also a 
big land mine for others.

is there a way to disable this?

David Lang
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help