I was trying to get revisions of some files in this repository - https://github.com/wildfly/wildfly. I selected the file at this location to work with. However, I observed that extra revisions are being shown for this file.
git log --follow --pretty=format:"%H" -- appclient/src/main/java/org/jboss/as/appclient/deployment/AppClientAttachments.java
outputs21c42698945b95423f8190983c026037b546800b
e1cdd97efac2697f0c5d06dcaae2242ff42ed273
95695f79a99ceb09c934ad1eb8fd2fb6aa24f668
a362f9f069f601e817851bf748ef39b9645dbdc0
4efa72403a27d7d43af1b4e20c302090262a34a9
e185b80348e43b96eb740337a6bf10859e941c65
f15c7d33dfed977592bfd8280f1de162098094a7
e5b791a896fcaa6698b217544fe4ed74c0fea8e4
6b4564be9b041ba985ba4d421de00b595464f811
beeb20330d46488fda930e7915f679bc3465478c
bbdf655522912d914a51a9fd7b9a001fb03fb50e
c92a75ae2dd5595d4b586f50c6c01e25bac25810
52e2173b1de17ed14c9231299f0a21a6d7458686
13fcc1306f618631ba5ed985a0935adf0dd5b87c
36f30a498ad6201adca9bb44b271b09b2e86fa74
e6fe7b2f3b87a14cf9c7175f9dc80370bcf22e31
3cc56d37d5c4902c4b772b0532a9bf2c5c9f3195
5d9581a327658ef5d58ab4cdd8b9dea4e25f5314
git show 21c4269:./appclient/src/main/java/org/jboss/as/appclient/deployment/AppClientAttachments.java
. It is working for the 3 commits - (21c4269
, e1cdd9
, and 95695f7
) but when I run it for a362f9f
, I get this error:fatal: Path 'appclient/src/main/java/org/jboss/as/appclient/deployment/AppClientAttachments.java' exists on disk, but not in 'a362f9f'.
Checking out to the particular commit (a362f9f
) reveals that the file indeed does not exist. Then why is this commit being outputted when I run git log
?
You included --follow
in your git log
command, which instructs git to detect renames, and follow the history of said file through renames.
If you don't want that behavior, simply drop the --follow
option.
If you want that behavior : you will have to also understand what git log
chose to follow as a rename within your repository.
Add the extra option --name-status
, git log
will display extra information :
$ git log --name-status --follow --pretty=format:"%H" -- my/file
21c42698945b95423f8190983c026037b546800b
M my/file
e1cdd97efac2697f0c5d06dcaae2242ff42ed273
M my/file
95695f79a99ceb09c934ad1eb8fd2fb6aa24f668
R95 previous/my/file -> my/file
# after that, you should inspect 'previous/my/file', not 'my/file'
a362f9f069f601e817851bf748ef39b9645dbdc0
M previous/my/file
4efa72403a27d7d43af1b4e20c302090262a34a9
M previous/my/file
...