How to git log from all branches for the author at once?
GitGit Problem Overview
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 for the current branch. Is there any option that would log the commit messages for the author from all branches, not only form 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 concurently 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.
Git Solutions
Solution 1 - Git
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.
Solution 2 - Git
Instead of --all
you may want to use --branches
, since --all
also includes refs/tags
and refs/remotes
.