What does it mean when Git says 'rewrite' or 'rename' in a commit message?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Git itself usually does not invent human commit messages that say "rewrite" or "rename" unless a tool or developer wrote those words intentionally. What Git does show automatically is change metadata in logs and summaries, where rename means it detected a file move or rename, and rewrite often means a file changed so heavily that Git treats it more like a replacement than a small edit.
rename means Git detected the same file under a new path
Git does not store renames as a special first-class operation in the commit object. Instead, it compares file similarity and infers that one path became another path.
For example:
Git may display something like:
That means Git believes the file content is similar enough that this was a rename rather than a deletion plus a totally unrelated new file.
The percentage is a similarity score, not a magical certainty. If you rename a file and rewrite most of its contents, Git may or may not still detect it as a rename depending on how much similarity remains.
rewrite usually means the content changed drastically
The word rewrite often appears in diff summaries when Git sees a file whose content changed so much that it is effectively a near-total replacement.
For example:
might show a line that indicates a rewrite percentage. This is Git's way of saying, "Yes, the path still exists, but the content changed so extensively that this was not just a small patch."
This is different from history rewriting. It is about file-content similarity inside a commit comparison.
History rewrite is a separate Git concept
Git users also use the word "rewrite" to describe changes to commit history itself, such as:
- '
git commit --amend' - interactive rebase
- rebasing a branch onto a different base
- force-pushing rewritten commits
Example:
That command rewrites commit history because it creates new commit IDs. This is a different meaning from a diff summary saying a particular file was rewritten.
So if you saw "rewrite" somewhere, ask:
- Was Git talking about file content in a diff summary?
- Or was a person talking about rewritten commit history?
Those are related ideas, but they are not the same event.
Commit messages themselves are just text
If the commit message literally says "rewrite login flow" or "rename service layer," that may simply be a human description written by the author:
In that case, Git is not applying a special technical label. The author is just describing the change in natural language.
That is why context matters. Git log output, diff summaries, and hand-written commit messages all use the same words, but they do not always mean the same thing.
How to inspect what Git actually detected
If you want to know whether Git itself detected a rename or heavy rewrite, inspect the commit with summary output:
Or compare two revisions directly:
Those commands show Git's own interpretation of the file-level changes rather than only the author's free-form commit message text.
Common Pitfalls
The biggest mistake is assuming every appearance of the word rewrite means history was rewritten. Sometimes it only refers to a file whose contents changed drastically.
Another common issue is assuming rename means Git recorded an absolute rename operation. Git usually infers renames through similarity detection during comparison.
People also mix up commit messages written by humans with Git-generated summary lines. The same word can appear in both places for completely different reasons.
Finally, if a file was renamed and heavily edited, Git's rename detection may become less clear because similarity scores can drop below the detection threshold.
Summary
- '
renamein Git output usually means Git detected one file path becoming another.' - '
rewritein a diff summary usually means the file content changed heavily.' - History rewriting through rebase or amend is a different concept from file-content rewrite detection.
- A commit message containing those words may simply reflect the author's wording.
- Use
git show --summaryorgit diff --summaryto see what Git itself inferred.

