how to split the repository history one line for each commit?

Question:

I’m trying to have the history of a repository, but the result is returned to me on a single line of text.

The command I’m using:

 cmd = f'git log --all --grep="fixed bug"'

The result I would like to have:

commit 337f4f4e798ea675cd57348212857ce051e857ffAuthor: Vinod...
commit 0b5a4823a963bd898b3979de8cce67513a1f83e5Author: Lofdw Kuma...
Asked By: Mario

||

Answers:

Try this:

git log --pretty="Commit: %H %nAuthor: %an"
  • –pretty is the format you want it to have.
  • %H is the commit hash.
  • %an is the author name.
  • The %n stands for newline.
  • Everything in between is a string that you can form as you like.

This beautiful site has a lot of information about that topic:

https://git-scm.com/docs/pretty-formats

Answered By: tetris programming