找出git分支的创建者

编程入门 行业动态 更新时间:2024-10-23 07:38:46
本文介绍了找出git分支的创建者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我可以这样做:

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

然而,这会返回每个分支的最后一个提交者,而不一定是创建分支的人。 方案

分支只不过是一个提交指针。因此,它不会跟踪谁创造了我等元数据。你自己看。在你的仓库中试试 cat .git / refs / heads /< branch> 。 '真的在跟踪存储库中的这些信息,请查看分支描述。它们允许您将任意元数据附加到分支,至少在本地。

另外 DarVar的答案在下面是非常聪明的方式来获取这些信息。

I want to find out who created a branch.

I am sort-of able to do so with:

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.

解决方案

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.

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

更多推荐

找出git分支的创建者

本文发布于:2023-11-28 16:54:40,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:创建者   分支   git

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!