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

Re: renormalize histroy with smudge/clean-filter

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Feb 5, 2025, 22:55 UTC
Message-ID
<Z6PsXGnxM3UBR3nM@tapette.crustytoothpaste.net>
In-Reply-To
<20250205214726.GA30202@raven.inka.de>
On 2025-02-05 at 21:47:26, Josef Wolf wrote:
Show 11 quoted lines
> Hello all,
> 
> I have set up clean/smudge filters to normalzize files from an application to
> reduce the pain when those files are tracked by git.
> 
> The clean/smudge filter work well on new commit and the result of
> smudge+smudge+clean is the same as the result of a simple clean, so the filter
> should be fine IMHO.
> 
> But whenever I do any operations which introduce not yet normalized commits, I
> keep getting errors.

Yes, this is known to occur. It notably happens with Git LFS, which uses smudge and clean filters, and suffers from this same problem. Renormalizing is indeed the right solution.

Show 16 quoted lines
> So to get rod of those errors, I'd like to also renormalize the history:
> 
>   $ git rebase --root --strategy renormalize
>   error: Your local changes to the following files would be overwritten by
>   merge:
>         foo/bar/baz
>   Please commit your changes or stash them before you merge.
>   Aborting
>   $ git add foo/bar/baz
>   $ git commit -m renormalize foo/bar/baz
>   $ git rebase --continue
>   git: 'merge-renormalize' is not a git command. See 'git --help'.
>   error: could not apply abcdef... Foo Bar Baz
>   [ ... ]
> 
> Huh? I never entered a command "merge-renormalize"

When you use command like `--strategy foo` with a custom strategy, Git calls a binary called `git merge-foo` to implement that strategy. So while you didn't explicitly invoke that, when you used the nonstandard strategy `renormalize` (which, by the way, does not exist), Git invoked it when you rebased, since rebases by default use merges under the hood.

> BTW: It does not make any difference whether I add "-c merge.renormalze=true"

That option also does not exist. Can you tell us where you found such a recommendation? If we've been misleading people in our documentation, I'd like to fix.

> What would be the proper way to renormalize history?

The command that needs to be done is `git add --renormalize .` I think you probably want to do is something like this: `git rebase --root -x 'git add --renormalize . && git commit --amend --no-edit'`.

You might also be able to use `git filter-repo` to do this in a nicer way, but I'm not aware of how to do that. I've CCed the maintainer, however, in case he or anyone else can provide an answer.

-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
Previous: Josef WolfNext: Josef Wolf
Message 2 of 44 in “renormalize histroy with smudge/clean-filter”
  1. Josef WolfFeb 5, 2025
  2. brian m. carlsonFeb 5, 2025
  3. Josef WolfFeb 5, 2025
  4. brian m. carlsonFeb 6, 2025
  5. Elijah NewrenFeb 6, 2025
  6. Josef WolfFeb 6, 2025
  7. Josef WolfFeb 6, 2025
  8. Chris TorekFeb 7, 2025
  9. Josef WolfFeb 7, 2025
  10. Torsten BögershausenFeb 7, 2025
  11. Chris TorekFeb 7, 2025
  12. Chris TorekFeb 7, 2025
  13. Elijah NewrenFeb 7, 2025
  14. Josef WolfFeb 7, 2025
  15. Elijah NewrenFeb 8, 2025
  16. Phillip WoodFeb 8, 2025
  17. Josef WolfFeb 8, 2025
  18. Elijah NewrenFeb 8, 2025
  19. Josef WolfFeb 8, 2025
  20. D. Ben KnobleFeb 9, 2025
  21. Josef WolfFeb 9, 2025
  22. Elijah NewrenFeb 9, 2025
  23. Josef WolfFeb 9, 2025
  24. D. Ben KnobleFeb 10, 2025
  25. Josef WolfFeb 8, 2025
  26. Elijah NewrenFeb 8, 2025
  27. Josef WolfFeb 9, 2025
  28. Torsten BögershausenFeb 9, 2025
  29. Josef WolfFeb 9, 2025
  30. Josef WolfFeb 9, 2025
  31. Josef WolfFeb 9, 2025
  32. Josef WolfFeb 7, 2025
  33. Junio C HamanoFeb 7, 2025
  34. Phillip WoodFeb 6, 2025
  35. Elijah NewrenFeb 6, 2025
  36. Junio C HamanoFeb 6, 2025
  37. Josef WolfFeb 11, 2025
  38. Torsten BögershausenFeb 12, 2025
  39. Josef WolfFeb 12, 2025
  40. Collisions while cloning (was: Re: renormalize histroy with smudge/clean-filter, again)Josef Wolf, Feb 13, 2025
  41. Torsten BögershausenFeb 13, 2025
  42. Josef WolfFeb 14, 2025
  43. brian m. carlsonFeb 14, 2025
  44. Josef WolfFeb 14, 2025

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.