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

Re: git refuses to switch to older branches

From
Jakub Narebski <jnareb@gmail.com>
Date
Aug 19, 2006, 22:48 UTC
Message-ID
<ec84gg$p2l$1@sea.gmane.org>
In-Reply-To
<7v3bbs1h8c.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
Show 25 quoted lines
> Jakub Narebski <jnareb@gmail.com> writes:
> 
>> Martin Waitz wrote:
>>
>>> now that gitweb.cgi is autogenerated, git refuses to switch to old
>>> branches unless force is applied:
>>> 
>>>       fatal: Untracked working tree file 'gitweb/gitweb.cgi' would
>>>       be overwritten by merge.
>>> 
>>> This safety measure is quite useful normally, but for files that are
>>> explicitly marked as to-be-ignored it should not be neccessary.
>>> 
>>> But all the code that handles .gitignore is only used by ls-files now.
>>> Does it make sense to add exclude handling to unpack-trees.c, too?
>>
>> I think it is "better to be annoying but safe" idea of git. You can always
>> do "git checkout <branch> gitweb/gitweb.cgi" and "git checkout <branch>",
>> and not use -f.
> 
> I think you are talking backwards.  Newer branch have .cgi
> generated and older branch has it tracked.  After you have built
> in a newer branch, checking out an older branch without -f
> option would play it safe not to clobber .cgi which is
> annoying.  So workaround you would want to suggest is TO USE -f.

If I remember correctly that is what I did when "master" (and I had switch to master to do "git pull origin") didn't contain gitweb.cgi -> gitweb.perl rename. My proposed solution first overwrites generated gitweb.cgi by tracked file (i'm not sure if this is feature or bug that git-checkout with file specified (path limit specified?) doesn't need -f, and then you can do git-checkout full branch without -f.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 15 in “git refuses to switch to older branches”
  1. Martin WaitzAug 19, 2006
  2. Jakub NarebskiAug 19, 2006
  3. Junio C HamanoAug 19, 2006
  4. Jakub NarebskiAug 19, 2006
  5. Junio C HamanoAug 20, 2006
  6. Junio C HamanoAug 19, 2006
  7. Petr BaudisAug 19, 2006
  8. Martin WaitzAug 20, 2006
  9. Johannes SchindelinAug 20, 2006
  10. Martin WaitzAug 20, 2006
  11. Johannes SchindelinAug 20, 2006
  12. Josef WeidendorferAug 20, 2006
  13. Alex RiesenAug 20, 2006
  14. Martin WaitzAug 20, 2006
  15. Alex RiesenSep 8, 2006

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.