Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8840437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:27:53+00:00 2026-06-14T10:27:53+00:00

When dealing with binary files git seems to consider replacing a file with another,

  • 0

When dealing with binary files git seems to consider replacing a file with another, modified, file a rename. This happens e.g. when replacing foo-1.0.1.jar with foo-1.0.3.jar or with the following test-case:

$ dd if=/dev/urandom of=test.dat bs=1024 count=10
$ md5sum test.dat
8073aef704e9df13b44818371ebbcc0b  test.dat
$ git add test.dat && git commit -m 'add binary file'
$ mv test.dat test2.dat
$ git rm test.dat
$ dd if=/dev/urandom of=test2.dat bs=1 count=1 conv=notrunc
$ md5sum test2.dat
21e1ac3ab9ba50c9dad9171f9de7232d  test2.dat
$ git add test2.dat

Now I clearly have a file with new contents (at least partially) and a new name. However, git considers this a rename in git status:

$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       renamed:    test.dat -> test2.dat
  • What’s the reason for this, e.g. how similar do those two files have to be? It doesn’t seem to happen if test2.dat contains completely different data.
  • Does it have any disadvantages except looking somewhat awkward? The actual data seem to be perfectly fine; when checking out the previous revision I do get the correct file for that rev.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:27:54+00:00Added an answer on June 14, 2026 at 10:27 am

    Git doesn’t actually store renames, it just stores a new tree with one file deleted and another one added. Git commands that compare trees (git diff, git log, git status) detect renames based on content.

    For some reason the rename detection fires for your files. Maybe their contents are similar if you’ve depleted the entropy in /dev/urandom?

    Edit: See e.g. How does git detect similar files, for its rename detection? for details about rename detection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am dealing with quite a few binary files generated by a program. Auto
Having an issue with my fwrite() and fread() dealing with a binary file here
I've always read and been told that when dealing with binary files that one
I have a file that contains this kind of paths: C:\bad\foo.c C:\good\foo.c C:\good\bar\foo.c C:\good\bar\[variable
When dealing with a single file, I'm used to: /blah do some work n
I am dealing with very primitive HTML construction that goes like this: <a NAME=header1></a><b><font
I have a repository for storing some large binary files (tifs, jpgs, pdfs) that
i want to read\write a binary file which has the following structure: The file
This is an issue I have been dealing with for months, and I would
I'm trying to parse a binary file format in Haskell (Apple's binary property list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.