git log --follow 包括错误提交
git log --follow including wrong commits
我试图获取此存储库中某些文件的修订版 - https://github.com/wildfly/wildfly. I selected the file at this location 以供使用。但是,我发现该文件显示了额外的修订。
git log --follow --pretty=format:"%H" -- appclient/src/main/java/org/jboss/as/appclient/deployment/AppClientAttachments.java
输出
21c42698945b95423f8190983c026037b546800b
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
。它适用于 3 次提交 -(21c4269
、e1cdd9
和 95695f7
)但是当我 运行 它用于 a362f9f
时,我收到此错误:
fatal: Path 'appclient/src/main/java/org/jboss/as/appclient/deployment/AppClientAttachments.java' exists on disk, but not in 'a362f9f'.
检查特定提交 (a362f9f
) 表明该文件确实不存在。那为什么我 运行 git log
?
输出这个commit
您在 git log
命令中包含了 --follow
,它指示 git 检测重命名,并通过重命名跟踪所述文件的历史记录。
如果您不想要这种行为,只需删除 --follow
选项即可。
如果您想要这种行为:您还必须了解 git log
在您的存储库中选择遵循什么作为重命名。
添加额外选项--name-status
,git log
会显示额外信息:
$ 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
...
我试图获取此存储库中某些文件的修订版 - https://github.com/wildfly/wildfly. I selected the file at this location 以供使用。但是,我发现该文件显示了额外的修订。
git log --follow --pretty=format:"%H" -- appclient/src/main/java/org/jboss/as/appclient/deployment/AppClientAttachments.java
输出
21c42698945b95423f8190983c026037b546800b
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
。它适用于 3 次提交 -(21c4269
、e1cdd9
和95695f7
)但是当我 运行 它用于a362f9f
时,我收到此错误:
fatal: Path 'appclient/src/main/java/org/jboss/as/appclient/deployment/AppClientAttachments.java' exists on disk, but not in 'a362f9f'.
检查特定提交 (a362f9f
) 表明该文件确实不存在。那为什么我 运行 git log
?
您在 git log
命令中包含了 --follow
,它指示 git 检测重命名,并通过重命名跟踪所述文件的历史记录。
如果您不想要这种行为,只需删除 --follow
选项即可。
如果您想要这种行为:您还必须了解 git log
在您的存储库中选择遵循什么作为重命名。
添加额外选项--name-status
,git log
会显示额外信息:
$ 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
...