Git 在给定提交ID之前列出提交

Git 在给定提交ID之前列出提交,git,git-log,Git,Git Log,我的回购顶层层次结构如下所示: /dir1 /dir2 /dir3 我很高兴,git log-oneline-first parent-5-dir1/给出了如下内容: abcb COMM-25 Fix latest ba0f COMM-17 Some stuff cda8 New files db7c COMM-9 Feature merge e20a Init smth 网络上有很多很酷的东西,比如git log-oneline-first parent db7c..-dir1/获得 甚至

我的回购顶层层次结构如下所示:

/dir1
/dir2
/dir3
我很高兴,git log-oneline-first parent-5-dir1/给出了如下内容:

abcb COMM-25 Fix latest
ba0f COMM-17 Some stuff
cda8 New files
db7c COMM-9 Feature merge
e20a Init smth
网络上有很多很酷的东西,比如git log-oneline-first parent db7c..-dir1/获得

甚至git log-oneline-first parent db7c..ba0f-dir1/两端都要限制

ba0f COMM-17 Some stuff
cda8 New files
但是,见鬼,我找不到任何有助于将所有提交输出到特定提交id的东西。 我需要像git log-oneline-first parent..cda8-dir1/这样的东西来获取

只有cda8散列。上面最新的命令当然是一个伪代码,在现实生活中没有提供任何输出

那么,如何在不更改头的情况下列出特定目录中以及给定提交id之前的所有提交

我想我可以只接受修改dir1的内容dir1,而不涉及dir2和dir3!,但是,执行git签出cda8 dir1/或git重置cda8 dir1/对随后的git日志-dir1/输出没有任何影响

请帮帮我,git大师

我认为你在这里太努力了,这就是为什么你看不到隐藏在眼前的解决方案

您需要的是给定refspec时的标准日志行为。它将记录从该点可访问的所有提交历史记录*:

git log --oneline --first-parent cda8 -- dir1/
请注意,我已经完成了您的最后一次尝试,省略了。。应输出:

cda8 New files
db7c COMM-9 Feature merge
e20a Init smth
...
<follows ALL the rest of commits history (but only those which have modified dir1/)>

*git中的reachable应该理解为通过递归搜索给定提交的父级可以访问

如果目标是在提交id之前列出所有rev,那么您可能希望使用提交id^,在这种情况下可能是ba0f^:-@约翰斯扎克迈斯特完全同意。我坚持以OP的例子来保持一致的比较,并关注他的预期产出,但从技术上回答他的标题问题,你是绝对正确的!哈哈,我怎么会错过这个?!非常感谢,伙计们,这很有魅力。@RAM237我们都去过!
git log --oneline --first-parent cda8 -- dir1/
cda8 New files
db7c COMM-9 Feature merge
e20a Init smth
...
<follows ALL the rest of commits history (but only those which have modified dir1/)>