Git 提交出现在 git 日志中,但不出现在 git 日志中 <filepath>
Git commits appear with git log but not with git log <filepath>
当我 运行 git log --name-status
我可以看到我的文件在我的提交中被修改了。
但是,当我 运行 git log myfilename
指定出现在上一个命令中的文件名之一时,未列出一些提交。
为什么会这样?
The commits appear when I use --follow
or --full-history
.
这意味着您的文件已:
- 重命名(
--follow
)
- 涉及合并分支(
--full-history
,因为如果最终结果相同(即合并具有相同内容的分支),默认模式会修剪一些侧分支
查看博客post "Git – Full History" from Scott Smith:
a series of changes can cancel each other out which means that history is “simplified” by default.
Those changes that cancel each other out will appear to have never existed without using the “–full-history
” switch.
Ben confirms the second case :
what happened was first the changes that I made on my branch were merged back to the main line.
Afterwards the same changes were duplicated on another branch by another developer and then merged back in to the main line.
当我 运行 git log --name-status
我可以看到我的文件在我的提交中被修改了。
但是,当我 运行 git log myfilename
指定出现在上一个命令中的文件名之一时,未列出一些提交。
为什么会这样?
The commits appear when I use
--follow
or--full-history
.
这意味着您的文件已:
- 重命名(
--follow
) - 涉及合并分支(
--full-history
,因为如果最终结果相同(即合并具有相同内容的分支),默认模式会修剪一些侧分支
查看博客post "Git – Full History" from Scott Smith:
a series of changes can cancel each other out which means that history is “simplified” by default.
Those changes that cancel each other out will appear to have never existed without using the “–full-history
” switch.
Ben confirms the second case
what happened was first the changes that I made on my branch were merged back to the main line.
Afterwards the same changes were duplicated on another branch by another developer and then merged back in to the main line.