如何使用 git log 查看提交的原始分支(和文件更改)?

发布于 2024-11-27 16:30:19 字数 229 浏览 0 评论 0原文

我读到了一个类似的问题,建议使用 git log --graph --all --decorate 。这样做的问题是,它不会显示很久以前合并和删除分支的日志条目的分支名称。

我感兴趣的基本上与直接的 git log 命令完全相同,但有额外的信息来显示它所提交的分支的名称以及修改/添加的文件/在提交中删除。我希望分支名称可用,无论它是否已被删除。

有没有办法在不使用模板或挂钩修改默认提交消息的情况下执行此操作?

I read a similar question about this that suggested using git log --graph --all --decorate. The problem with this is that it doesn't display branch names for log entries that have had their branch merged and deleted long ago.

What I'm interested in is basically the exact same thing as the straight git log command, but with extra info to show me the name of the branch it was committed to and the files that were modified/added/deleted in the commit. I'd like the branch name to be available regardless of whether or not it has been deleted.

Is there any way to do this without modifying the default commit message using a template or hook?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

阳光①夏 2024-12-04 16:30:19

正如安迪回答的那样 - 该信息不会保留。如果您仔细考虑一下,就会很清楚地发现这些信息根本没有必要。在 git 中,就像在分布式 VCS 中一样,在代码合并到主线之前,没有必要知道另一个开发人员如何调用他的分支。知道它有什么意义呢?真的有帮助吗?
查看历史上两个点之间更改的文件列表

git whatchanged

至于问题的其他部分,您可以使用或

git log --stat

As Andy answered - this info is not kept. If you will think about it it will become pretty clear that this information is not necessary at all. In git as in distributed VCS there is no point of knowing how another developer called his branch before the code got merged into the mainline. What is the point of knowing it? Does it really help?
As for the other part of the question you can see the list of files changed between two points in history using

git whatchanged

or

git log --stat
〗斷ホ乔殘χμё〖 2024-12-04 16:30:19

你不能用 git 做到这一点。它不会跟踪提交的分支,因此一旦删除该分支,git 就不知道它曾经存在过。

You can't do that with git. It doesn't keep track of the branch the commit was made to, so once you delete the branch, git has no idea that it ever existed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文