lolololol ol
lolololol ol

Reputation: 868

File never renamed, yet git log shows different output with --follow option

I made a commit 9ffff which is a commit of changes for one file, myfile.c. This file has never been renamed.

When I run a git log myfile.c I cannot see the commit 9ffff in the output of this command. When I run a git log --follow myfile.c, however, I see the commit 9ffff in this command preceded by a merge commit 8ffff.

The --follow option continues listing the history of a file beyond renames (works only for a single file) according to the git reference documentation. Given the above, how is it possible the --follow option shows me the 9ffff commit when the file myfile.c has not ever been renamed?

Upvotes: 0

Views: 43

Answers (1)

jthill
jthill

Reputation: 60275

Check what the docs say about specifying a path, in particular the reference to history simplification. Most common way to get what you're looking at is to make a change, revert it, and then merge. Git won't show you the change and the revert, since the combination has no effect so they're almost certainly not why you're inspecting the logs. If you do want to see even commits that wind up having no effect, add --full-history.

Upvotes: 2

Related Questions