显示别名的分支的别名,这些分支位于master的前面/后面 [英] Alias that displays how many commits branches are ahead/behind master
问题描述
新的Bitbucket分支页面很棒.它显示每个分支在主控之前/之后的提交次数.有显示相同信息的Git别名吗?
The new Bitbucket Branches page is awesome. It shows how many commits each branch is ahead/behind master. Is there an Git alias that displays same information?
信息应显示:
- 分支名称
- 上次更新时间
- 有多少人提交了其背后的主人
- 有多少人领先于大师
推荐答案
看看我在一个稍有不同的问题的答案中发布的脚本:https://stackoverflow.com/a/18760795/683080
Take a look at the script I posted in an answer to a slightly different question: https://stackoverflow.com/a/18760795/683080
您需要确保使用最新的git fetch
或git fetch --all
.并且,一旦出现,您就可以使用它来显示分支的前方或后方的距离. Git不会存储此信息的缓存版本,因此,如果您的分支确实很落后(例如,在Linux内核的当前尖端之后有6,000个提交),那么计算可能会花费一些时间.否则,它会很快.
You need to make sure you're up-to-date with a git fetch
or git fetch --all
. And once you are, you can use it to display how far ahead or behind the branches are. Git doesn't store cached versions of this information, so if you're branch is really far behind (like 6,000 commits behind the current tip of the Linux kernel), then it may take a little while to compute. Otherwise, it's pretty quick.
一个小注意事项:该脚本未显示上次更新的日期,但确实显示了其余日期.
One small note: the script doesn't show the date it was last updated, but it does show the rest.
这篇关于显示别名的分支的别名,这些分支位于master的前面/后面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!