找出一个Git分支创建者 [英] Find out a Git branch creator

查看:111
本文介绍了找出一个Git分支创建者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找出谁创建了分支.

I want to find out who created a branch.

我可以做到:

git branch -a | xargs -L 1 bash -c 'echo "$1 `git log --pretty=format:"%H %an" $1^..$1`"' _

但是,这将返回每个分支的最后一个提交者,不一定是创建分支的人.

However, this returns the last committer per branch, not necessarily the person who created the branch.

推荐答案

分支不过是提交指针.因此,它不会跟踪创建我的人"之类的元数据.你自己看.在您的存储库中尝试cat .git/refs/heads/<branch>.

A branch is nothing but a commit pointer. As such, it doesn't track metadata like "who created me." See for yourself. Try cat .git/refs/heads/<branch> in your repository.

这样写的话,如果您真的想在存储库中跟踪此信息,请查看分支描述.您至少可以在本地将任意元数据附加到分支.

That written, if you're really into tracking this information in your repository, check out branch descriptions. They allow you to attach arbitrary metadata to branches, locally at least.

另外 DarVar在下面的回答是获取此信息的一种非常聪明的方法.

Also DarVar's answer below is a very clever way to get at this information.

这篇关于找出一个Git分支创建者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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