问题
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