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

Re: Untracked working tree files

From
AMAndrew Morton <akpm@linux-foundation.org>
Date
Oct 15, 2008, 19:24 UTC
Message-ID
<20081015122407.f06e8f53.akpm@linux-foundation.org>
In-Reply-To
<alpine.DEB.1.10.0810151211580.7808@asgard.lang.hm>

On Wed, 15 Oct 2008 12:14:34 -0700 (PDT) david@lang.hm wrote:

Show 23 quoted lines
> On Wed, 15 Oct 2008, david@lang.hm wrote:
> 
> > On Wed, 15 Oct 2008, Andrew Morton wrote:
> >
> >> 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 was using this but it seems it wasn't in the right place in the script.
> I think you can also do git checkout -f head to force the checkout to 
> overwrite all files
OK, I'll try that.
> 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.

These files weren't modified. By me, at least. git might have "modified" them, but it has all the info necessary to know that the file has no uncommitted changes.

> is there a way to disable this?
> 
> David Lang
Previous: david@lang.hmNext: Andrew Morton
Message 4 of 24 in “Untracked working tree files”
  1. Andrew MortonOct 15, 2008
  2. david@lang.hmOct 15, 2008
  3. david@lang.hmOct 15, 2008
  4. Andrew MortonOct 15, 2008
  5. Andrew MortonOct 15, 2008
  6. Nicolas PitreOct 15, 2008
  7. Nicolas PitreOct 15, 2008
  8. Linus TorvaldsOct 15, 2008
  9. david@lang.hmOct 15, 2008
  10. Linus TorvaldsOct 15, 2008
  11. david@lang.hmOct 15, 2008
  12. Andrew MortonOct 15, 2008
  13. Linus TorvaldsOct 15, 2008
  14. Andrew MortonOct 15, 2008
  15. Paolo CiarrocchiOct 16, 2008
  16. Andrew MortonOct 16, 2008
  17. Linus TorvaldsOct 15, 2008
  18. Andrew MortonOct 15, 2008
  19. Junio C HamanoOct 15, 2008
  20. reset --hard/read-tree --reset -u: remove unmerged new pathsJunio C Hamano, Oct 15, 2008
  21. Linus TorvaldsOct 15, 2008
  22. Junio C HamanoOct 16, 2008
  23. Ingo MolnarOct 16, 2008
  24. Junio C HamanoOct 16, 2008

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.