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

Re: impure renames / history tracking

From
Martin Langhoff <martin.langhoff@gmail.com>
Date
Mar 1, 2006, 18:05 UTC
Message-ID
<46a038f90603011005m68af7485qfdfffb9f82717427@mail.gmail.com>
In-Reply-To
<Pine.LNX.4.64.0603011558390.13612@sheen.jakma.org>
On 3/2/06, Paul Jakma <paul@clubi.ie> wrote:
Show 6 quoted lines
> I mean:
>
>         $ git checkout project
>         $ git pull . master
>         $ git checkout -b tmp project
>         $ git diff project..master | <git apply I think>

The moment you 'merge' by using git-diff | patch you lose all the support git gives you, because you are discarding all of git's metadata! git's metadata is about all the commits you are merging, and is good enough that it will help future merges across renames.

You should really use git-pull/git-merge at that point.
My guess is that you do this to achieve what you describe later:
Show 6 quoted lines
> Presume that 'project' in the workflow is defined as
>
>         "achieve one goal with one commit to the master"
>
> So by definition, it always correct that the project only ever has
> one commit.

What happens if you rephrase that to read: "achieve one goal with one merge to the master"? Long term, it gives you much better support from the SCM. If a particular commit broke something, you can use whatchanged, log, annotate and bisect to figure out in which /small/ commit things went astray.

And you can modify your practices ever so slightly to match the benefits of the old model:

 - force merge message editing in git-merge, and prepare appropriate
commit messages for your merges
 - write a modified git-log that displays only the merges to master
that way, you get the best of both worlds.
> The trouble is that /sometimes/ projects do indeed 'rename and
> rewrite' a file. At present, chances are git might not notice this,
It will, if you preserve git's metadata.

The thing is that with any scm that tracks metadata of some kind, the moment you bypass its tools and do diff|patch to discard the metadata... well, you lose its benefits...

And what I've found, managing a project with 13K files, is that in practice git does far better tracking renames than several SCMs that do explicit tracking. Don't be distracted by the 'we don't track renames posturing'. We do, and it's so magic that it just works.

cheers,
Previous: Andreas EricssonNext: Paul Jakma
Message 9 of 15 in “impure renames / history tracking”
  1. Paul JakmaMar 1, 2006
  2. Andreas EricssonMar 1, 2006
  3. Paul JakmaMar 1, 2006
  4. Linus TorvaldsMar 1, 2006
  5. Paul JakmaMar 1, 2006
  6. Andreas EricssonMar 1, 2006
  7. Paul JakmaMar 2, 2006
  8. Andreas EricssonMar 2, 2006
  9. Martin LanghoffMar 1, 2006
  10. Paul JakmaMar 1, 2006
  11. Junio C HamanoMar 1, 2006
  12. Paul JakmaMar 1, 2006
  13. Andreas EricssonMar 1, 2006
  14. Paul JakmaMar 1, 2006
  15. Junio C HamanoMar 1, 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.