如何使用 git log 查看提交的原始分支(和文件更改)?
我读到了一个类似的问题,建议使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如安迪回答的那样 - 该信息不会保留。如果您仔细考虑一下,就会很清楚地发现这些信息根本没有必要。在 git 中,就像在分布式 VCS 中一样,在代码合并到主线之前,没有必要知道另一个开发人员如何调用他的分支。知道它有什么意义呢?真的有帮助吗?
查看历史上两个点之间更改的文件列表
至于问题的其他部分,您可以使用或
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
or
你不能用 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.