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

Re: bisect / history preserving on rename + update

From
David Kastrup <dak@gnu.org>
Date
Aug 14, 2007, 10:03 UTC
Message-ID
<86d4xqh1r5.fsf@lola.quinscape.zz>
In-Reply-To
<1187080681.12828.174.camel@chaos>
Thomas Gleixner <tglx@linutronix.de> writes:
Show 29 quoted lines
> is there a built in way to handle the following situation:
>
> file A is renamed to B
> file A is created again and new content is added.
>
> I found only two ways to do that, which both suck:
>
> 1)
> 	git-mv A B
> 	git-add A
> 	git commit
>
> 	results in a copy A to B and lost history of B
>
> 2)
> 	git-mv A B
> 	git commit
> 	git-add A
> 	git commit
>
> 	preserves the history of B, but breaks bisection because
> 	A is needed to compile
>
> I have no real good idea how to solve this. After staring at the git
> source for a while, I think that 1) is quite hard to solve. A sane
> solution for 2) might be to add a flag to the second commit, which
> bundles the two commits for bisection.
>
> Any other solutions ?

You are confused, probably because something like "git-mv" exists (it is just syntactic sugar, and it might be less confusing to users to actually remove it). git does _not_ track file histories. Not the tiniest bit.

It _constructs_ them when you ask it nicely. All commands that display "tracking" information have options like -M -C -R and so on that tell git just how much effort it should spend on keeping abreast of copying/renaming/modification.

-- 
David Kastrup
Previous: David KastrupNext: Linus Torvalds
Message 10 of 15 in “bisect / history preserving on rename + update”
  1. Thomas GleixnerAug 14, 2007
  2. Karl HasselströmAug 14, 2007
  3. Thomas GleixnerAug 14, 2007
  4. Karl HasselströmAug 14, 2007
  5. Thomas GleixnerAug 14, 2007
  6. David KastrupAug 14, 2007
  7. Karl HasselströmAug 14, 2007
  8. Thomas GleixnerAug 14, 2007
  9. David KastrupAug 14, 2007
  10. David KastrupAug 14, 2007
  11. Linus TorvaldsAug 14, 2007
  12. Junio C HamanoAug 25, 2007
  13. David KastrupAug 25, 2007
  14. Linus TorvaldsAug 25, 2007
  15. Junio C HamanoAug 25, 2007

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.