为什么 git 认为 HEAD 是 17 年前的第一次提交?
Why does git think HEAD is the first commit from 17 years ago?
我正在尝试收集 [NOW, THEN]
范围内的提交列表,其中 NOW
是 HEAD
,[THEN]
是 8af39377
,它大约有 120 次提交。
When I run:
> git log 8af39377289feba1876b3252b6d23 HEAD --oneline | cut -d " " -f 1 > commits.txt
然后查看 commits.txt
,它有 2300 行长,它显示顶部条目为 8af39377
(THEN
),底部条目显示为 a3b6ece
( 2002 年的第一次提交)。
为什么 Git 认为 HEAD
是对存储库的第一次提交?
你的语法有误。如果你想要 8af39 和 HEAD 之间的范围,那么你需要 8af39..HEAD
至于为什么显示 17 年前,如果您只指定一个修订版,它会发现该提交可访问的所有提交。由于所有提交都有指向根的向后指针,因此您正在查找根提交。
Revision Specification 请参阅有关指定范围的部分。
git log 8af39377289feba1876b3252b6d23 HEAD --oneline
也就是说 "give me the entire history of those two commits, sorted in date order constrained by ancestry"。
你想要
the list of commits in the range [NOW, THEN], where NOW is HEAD and [THEN] is 8af39377, and its about 120 commits ago
但您的日志输出与您矛盾:git log
首先显示其输出 most-recent,受祖先限制,
it shows the top entry as 8af39377.
所以你的提交顺序是错误的。如果您没有使默认输出静音,它也会明确地向您显示提交日期,因此您会看到它是日期还是祖先问题。
不管是哪个,
git log --oneline HEAD..8af39377
将显示列表。
可能值得添加 --graph --decorate
。
我正在尝试收集 [NOW, THEN]
范围内的提交列表,其中 NOW
是 HEAD
,[THEN]
是 8af39377
,它大约有 120 次提交。
When I run:
> git log 8af39377289feba1876b3252b6d23 HEAD --oneline | cut -d " " -f 1 > commits.txt
然后查看 commits.txt
,它有 2300 行长,它显示顶部条目为 8af39377
(THEN
),底部条目显示为 a3b6ece
( 2002 年的第一次提交)。
为什么 Git 认为 HEAD
是对存储库的第一次提交?
你的语法有误。如果你想要 8af39 和 HEAD 之间的范围,那么你需要 8af39..HEAD
至于为什么显示 17 年前,如果您只指定一个修订版,它会发现该提交可访问的所有提交。由于所有提交都有指向根的向后指针,因此您正在查找根提交。
Revision Specification 请参阅有关指定范围的部分。
git log 8af39377289feba1876b3252b6d23 HEAD --oneline
也就是说 "give me the entire history of those two commits, sorted in date order constrained by ancestry"。
你想要
the list of commits in the range [NOW, THEN], where NOW is HEAD and [THEN] is 8af39377, and its about 120 commits ago
但您的日志输出与您矛盾:git log
首先显示其输出 most-recent,受祖先限制,
it shows the top entry as 8af39377.
所以你的提交顺序是错误的。如果您没有使默认输出静音,它也会明确地向您显示提交日期,因此您会看到它是日期还是祖先问题。
不管是哪个,
git log --oneline HEAD..8af39377
将显示列表。
可能值得添加 --graph --decorate
。