Git log suppress refs matching a given pattern

I regularly use the following git-log command:

 git log --oneline --graph --decorate --all 

The team is perfect for me, with one exception. I maintain a set of refs in refs/arch/ that I want to keep ("arch" means "archive"), but I don't want to see them every time I look at my git log. I do not mind their appearance if they are the ancestors of an existing branch or tag , but I really do not want to see a series of commits that would not otherwise appear in the git log, but for the fact that they are in the commit history of the given refs/arch/* ref .

For example, in the image below, the left side is an illustration of what I am currently seeing when I run git log --oneline --graph --decorate --all . As you can see, the commit referenced by refs/arch/2 will not appear in the log if that ref does not exist. (Assume there are no refs in the image on the left). Now the right part is an illustration of two alternative log schedules, each of which would be completely accurate. I don't mind seeing anything matching refs/arch/* if it is in the history of a branch or tag commit. But in the image below, I definitely don't want to see the commit referenced by refs/arch/2 .

Illustration of question

How can my git-log command be modified to suppress refs/arch/* in any of the feelings depicted in the illustration?

+6
source share
1 answer

What would you like:

 git log --oneline --graph --decorate --exclude 'refs/arch/*' --all 

The --exclude new in git 1.9.0 .


On the git -log man page:

--exclude=<glob-pattern>

Do not include refs matching <glob-pattern> , which would otherwise be considered by the following --all , --branches , --tags , --remotes or --glob . Repetitions of this option accumulate exception patterns until the following --all , --branches , --tags , --remotes or --glob option (other parameters or arguments do not clear accumulated patterns).

The specified patterns should not start with refs/heads , refs/tags or refs/remotes when applied to --branches , --tags or --remotes respectively, and they should start with refs/ when applied before --glob or --all . If the final /* intended, it must be specified explicitly.


If you have any taste of Ubuntu, you can upgrade git from Ubuntu git Native ppa command .

  • sudo add-apt-repository ppa:git-core/ppa
  • sudo apt-get update
  • sudo apt-get upgrade
+6
source

Source: https://habr.com/ru/post/974590/


All Articles