我如何跟踪合并后的提交内容? [英] How can I keep track of where commits came from once they've been merged?

查看:100
本文介绍了我如何跟踪合并后的提交内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的公司没有使用 git (我们有效地使用CVS)维护存储库,但为了我自己的理智,我在本地保存了一个存储库。在过去,我想提出与 bug-report-abcde 有关的提交。我可以通过提交消息grep来找到 bug-report-abcde 并浏览它们。现在,我有一个Emacs函数挂钩,以提供当前分支名称作为提交中的'header':

  Title 

摘要摘要摘要

分支:bug-report-abcde


$ b $因此,我的问题是:在提交已被合并到另一个分支之后,这是否是找到哪个分支是提交的原始源的最佳方式?或者有没有办法从 git 本身提取这些信息? > Git不会按设计跟踪这些信息。

http://markmail.org/message/yfb5ihwddjmrstz6

 所以,不要认为它是git抛出分支标识多达
git从来没有关心分支机构的身份,而且b $ b也不认为它是相关的。

您的分行名称就是您的分行名称。它可以是字面上任何你想要的。或者你不能使用分支名称,并处于分离状态。长期来看,只存储可执行性。



如果您有要跟踪的信息(如缺陷号),则需要将其包含在提交消息中。

如果您使用的是中央服务器,您可以设置一个接收挂钩,以某种方式记录远程分支名称信息( git notes

My company does not maintain the repository with git (we effectively use CVS), but I keep a repo locally for my own sanity. In the past, I've wanted to bring up commits related to, say, bug-report-abcde. I can grep through the commit messages to find bug-report-abcde and browse them. Right now, I have an Emacs function hooked to provide the current branch name as a 'header' in the commit:

Title

Summary summary summary

Branch: bug-report-abcde

Thus my question is: is this the best way to find which branch was the original source of a commit, after the commit has been merged to another branch? Or is there a way to extract this information from git itself?

解决方案

Git doesn't track this information by design.

http://markmail.org/message/yfb5ihwddjmrstz6

So don't think of it as "git throws away branch identity" as much as
"git never cared about branch identity in the first place, and doesn't
think it's relevant."

Your branch name is just that, your branch name. It can be literally anything you want. Or you can not use a branch name, and be in detached head state. Long term, only commit reachability is stored.

If you have information you want to track (like a Defect Number), then you need to include it in the commit message.

If you are using a central server you can setup a receive hook which logs the remote branch name information somehow (git notes for instance). My company uses this. I find it only quasi-useful (mainly if you want to yell at a program manager instead of the guy who wrote or pushed the code).

这篇关于我如何跟踪合并后的提交内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆