pepr
pepr

Reputation: 20744

How to git log from all branches for the author at once?

I need to get the report of all commits that the author did. So far, I have the script that wraps the following command:

git log --pretty=format:"%ad:%an:%d:%B" --date=short --reverse --all --since=2.months.ago --author=Petr

It works fine. However, it reports only the actions of the current branch. Is there any option that would log the commit messages for the author from all branches, not only from the current one?

In other words, can git make a reverse sorted (by datetime) sequence of all the commits in repository and extract the log info from that sequence?

Solved: (copied from the comment below that is hidden otherwise)

The problem was that I have one repository and two clones to work concurrently on two branches. I did push the changes to the origin repository, but I forgot to fetch the changes to the cloned repository. This way it seemed that --all did not work when using it for the cloned repository.

Upvotes: 298

Views: 149381

Answers (2)

Gert Hengeveld
Gert Hengeveld

Reputation: 2918

Instead of --all you may want to use --branches, since --all also includes refs/tags and refs/remotes.

git log --branches --author=Petr

Upvotes: 110

CharlesB
CharlesB

Reputation: 90276

Your command is right, since you use the --all switch which gives all commits from all branches. To answer the question in your comment, it works also in bare repositories.

git log --all --author=Petr

Upvotes: 286

Related Questions