Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个包含不同模块的大型存储库,这些模块应该在不同的存储库中分解,每个模块一个。有时我featbranch在 repo 中创建了一个分支来处理特定模块,但featbranch对其他模块完全没有意义。你可以想象这可能导致的混乱......
featbranch
无论如何,我的问题是:如何获取更改特定文件的最新提交,以及该提交可能属于哪个分支?“最新”是指时间戳最高的那个,据我所知,来自不同分支的提交可能没有任何优先关系。
git log -n 1 --date-order --all -- <file>
(请注意,如果有人直接在较新的提交之上进行了“较旧的”提交,则这可能不是具有最新时间戳的提交。不过,这只会发生在有人谎报提交时间的情况下。)