Search code examples
gitgit-log

How to get the history of commit messages for a given author in a git branch?


I would like to get the history of commit messages for a given author in a git branch. Is there any easy way to achieve it other than to parse the log through programming?

UPDATED:

The following was expacted for me that does the same thing:

git log --author='some author' --pretty=oneline --abbrev-commit
git log --author='some author' --oneline

git log --help mentioned the follows:

   Commit Formatting
       --pretty[=<format>], --format=<format>
           Pretty-print the contents of the commit logs in a given format, where <format> can be one of oneline, short, medium, full, fuller, email, raw and
           format:<string>. See the "PRETTY FORMATS" section for some additional details for each format. When omitted, the format defaults to medium.

           Note: you can specify the default pretty format in the repository configuration (see git-config(1)).

       --abbrev-commit
           Instead of showing the full 40-byte hexadecimal commit object name, show only a partial prefix. Non default number of digits can be specified
           with "--abbrev=<n>" (which also modifies diff output, if it is displayed).

           This should make "--pretty=oneline" a whole lot more readable for people using 80-column terminals.

       --no-abbrev-commit
           Show the full 40-byte hexadecimal commit object name. This negates --abbrev-commit and those options which imply it such as "--oneline". It also
           overrides the log.abbrevCommit variable.

       --oneline
           This is a shorthand for "--pretty=oneline --abbrev-commit" used together.

Solution

  • You have to give Author name as registered in GIT repo. Or the Author email address will also work.

    e.g.

    git log --author='Bharat Biswal'
    git log --author='bharat.biswal@gmail.com'
    

    enter image description here