4

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

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

But in this case Git returns me all commits with notes, if such exist. I tried to use something like the following:

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

It looks like the command "--all" overrides "--no-notes" and nothing will happen.

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

P.S. Yes, I could execute "git notes", parse them and then subtract from "git log --all", but it seems to me there should be a much easier solution for such a trivial situation.

2 Answers 2

2

As you said, --all overrides --no-notes. So you may want to split --all to include only refs you want. If you just want to show all the branches:

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

or if you want more:

git log --pretty="%H %f" --no-notes --branches --tags --remote 
Sign up to request clarification or add additional context in comments.

Comments

0

It's not pretty, but instead of --all, you could do this:

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

Or in some other way enumerate just the refs you want to log, which can be understandably tedious if you have many branches/tags...

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.