英文:
how to split the repository history one line for each commit?
问题
我试图获取存储库的历史记录,但结果以单行文本返回给我。
我正在使用的命令是:
cmd = f'git log --all --grep="fixed bug"'
我想要获得的结果是:
commit 337f4f4e798ea675cd57348212857ce051e857ffAuthor: Vinod...
commit 0b5a4823a963bd898b3979de8cce67513a1f83e5Author: Lofdw Kuma...
英文:
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...
答案1
得分: 0
尝试这个:
git log --pretty="Commit: %H %nAuthor: %an"
- --pretty是你想要的格式。
- %H是提交哈希值。
- %an是作者姓名。
- %n代表换行符。
- 两者之间的所有内容都是你可以根据需要自定义的字符串。
这个优质网站包含了关于该主题的大量信息:
https://git-scm.com/docs/pretty-formats
英文:
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:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论