【发布时间】:2018-03-11 06:42:15
【问题描述】:
设置
git version 2.11.0.windows.1
这是一个 bash sn-p 来重现我的测试存储库:
git init
# Create a file
echo Hello > a.txt
git add a.txt
git commit -m 'First commit'
# Change it on one branch
git checkout -b feature
echo Hi > a.txt
git commit -am 'Change'
# Rename it on the other
git checkout master
git mv a.txt b.txt
git commit -m 'Move'
# Merge both changes
git merge --no-edit feature
最后,git log --graph --pretty=oneline --abbrev-commit 打印:
* 06b5bb7 Merge branch 'feature'
|\
| * 07ccfb6 Change
* | 448ad99 Move
|/
* 31eae74 First commit
问题
现在,我想获取b.txt(例如b.txt)的完整日志。git log --graph --pretty=oneline --abbrev-commit --follow -- b.txt 打印:
...
* | 1a07e48 Move
|/
* 5ff73f6 First commit
如您所见,Change 提交未列出,即使它确实修改了文件。
我想我已经追踪到--graph 对--topo-order 的隐含使用,因为添加--date-order 会恢复提交,但这可能是机会。
此外,添加-m 显示合并提交(这很好)和Change 提交,但随后合并提交重复:
* 36c80a8 (from 1a07e48) Merge branch 'feature'
|\
| | 36c80a8 (from 05116f1) Merge branch 'feature'
| * 05116f1 Change
* | 1a07e48 Move
|/
* 5ff73f6 First commit
问题
我缺少什么来解释我目睹的奇怪行为?
如何通过重命名清晰地显示更改文件的所有提交?
【问题讨论】: