Limit refs shown with git log --decorate

谁说我不能喝 提交于 2019-12-23 07:42:16

问题


I have 3 standard remotes for a the main repository I work in currently: a local backup, my development partner's workstation, and a hosted repository. We have 3 or 4 branches that are active most of the time, one being master.

I monitor the branches on a regular basis throughout the day using:

git log --graph --oneline --decorate -15 my-branch his-repo/his-branch master other-branch

--decorate is crucial because it lets me know the state of things in regards to our very volatile development branches. The problem is that I see all of the remote refs and all of the branches, tags, etc. in the decoration.

Is there any way to limit --decorate to only output certain refs? Listing the refs on the command line only limits the commits shown, not the refs shown.

Thanks, Mike


回答1:


You cannot limit this out-of-the box. But nothing is stopping you from scripting the manipulation of .git/refs and then restoring it right after :).




回答2:


No. If you're using decorate, it will use all available names as decorations. --decorate=short will reduce the clutter, but not reduce the total number of decorations you're going to be looking at.

You could write a script which decorates the output of git log yourself quite easily, if you need this specific functionality.




回答3:


Starting with Git 2.16, the option --decorate-refs-exclude allows:

--decorate-refs= --decorate-refs-exclude=

If no --decorate-refs is given, pretend as if all refs were included. For each candidate, do not use it for decoration if it

matches any patterns given to --decorate-refs-exclude or if it doesn’t match any of the patterns given to --decorate-refs.



来源:https://stackoverflow.com/questions/9366960/limit-refs-shown-with-git-log-decorate

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!