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

Re: Files modified, even after: git reset --hard

From
MMartin <git@mfriebe.de>
Date
Jul 25, 2021, 17:48 UTC
Message-ID
<04f3b300-3ccf-c91b-6406-6a998b473a24@mfriebe.de>
In-Reply-To
<4e9b54b4-8e40-7fd3-ae65-d33390f3af43@mfriebe.de>
On 25/07/2021 17:40, Martin wrote:
Show 17 quoted lines
> On 25/07/2021 17:04, Martin wrote:
>> I have some files, that will show up modified. Always.
>>
>> If I just switch to a commit, with clean worktree before, then those 
>> files will be modified.
>>
> ...
>> But I *suspect* that the blob contains either CrLf, or mixed 
>> line-endings.
>
> Maybe git replace?
> I figure if I do not replace the commit objects, but only the blobs to 
> which they point. Then all commits should keep their hashes. (so 
> references to any commit by hash would remain working)
>
> But it's thousands of commits, between the introduction of the issue, 
> and the commit where it's fixed.
Actually, git replace has a weird effect.

so I have "commit A" introducing the problem. Then many commits until "commit Y" fixing it.

If I do switch -f --detach A git add --renormalize the_file git commit -m foo git show   // get the new blob for the file git show A  // get the old blob for the file git replace  old_blob  new_blob

switch -f --detach A
Then "the_file" is still shown as modified.
Only
   git diff the_file
now returns empty
(where as before it returned the entire file)
On the plus side
   switch -f --detach B
has the same change, still modified, but no diff.
So one replace would solve the entire 1000 commits that are currently 
affected
Any idea, what causes the "modified" after the replace?
Previous: MartinNext: Martin
Message 3 of 16 in “Files modified, even after: git reset --hard”
  1. MartinJul 25, 2021
  2. MartinJul 25, 2021
  3. MartinJul 25, 2021
  4. MartinJul 25, 2021
  5. Chris TorekJul 26, 2021
  6. MartinJul 26, 2021
  7. Chris TorekJul 26, 2021
  8. MartinJul 26, 2021
  9. Chris TorekJul 26, 2021
  10. MartinJul 26, 2021
  11. Philip OakleyJul 26, 2021
  12. MartinJul 26, 2021
  13. Chris TorekJul 26, 2021
  14. MartinJul 27, 2021
  15. Philip OakleyJul 26, 2021
  16. MartinJul 26, 2021

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.