Git: How to get all commits from all branches without notes?

I need to get all commits from all branches. I retrieve them using the command:

git log --pretty="%H %f" --all 

But in this case, Git returns me all the commits with notes, if any. I tried using something like the following:

  git log --pretty="%H %f" --all --no-notes 

The "allall" command seems to override the "-no-notes" and nothing will happen.

Please advise how can I get all commits from all branches without notes?

PS Yes, I could do git notes, analyze them and then subtract them from git log -all, but it seems to me that for such a trivial situation it should be much easier to solve.

+4
source share
2 answers

As you said, --all overrides --no-notes . This way you can split the --all to include only the links you need. If you just want to show all branches:

 git log --pretty="%H %f" --no-notes --branches 

or if you want more:

 git log --pretty="%H %f" --no-notes --branches --tags --remote 
+2
source

This is not very, but instead of --all you can do this:

 git log --pretty="%H %f" `git for-each-ref --format="%(refname)" | grep -v refs/notes` 

Or in some other way, list only those links that you want to register, which can be tedious if you have many branches / tags ...

0
source

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


All Articles