使用gitlog时,如何按用户进行筛选,以便只看到该用户的提交?


当前回答

您甚至可以通过简单地使用用户名的一部分来简化这一点:

git log --author=mr  #if you're looking for mrfoobar's commits

其他回答

git log --author="that user"

您甚至可以通过简单地使用用户名的一部分来简化这一点:

git log --author=mr  #if you're looking for mrfoobar's commits
git help log

为您提供gitlog的手册页。按/,然后键入“author”,然后按Enter键,在那里搜索“作者”。键入“n”几次以进入相关部分,其中显示:

git log --author="username"

正如已经建议的那样。

注意,这将为您提供提交的作者,但在Git中,作者可以是与提交者不同的人(例如,在Linux内核中,如果您以普通用户身份提交补丁,则可能由其他管理用户提交)?有关详细信息)

大多数时候,人们所说的用户既是提交者,也是作者。

试试这个工具https://github.com/kamranahmedse/git-standup

用法

$ git standup [-a <author name>] 
              [-w <weekstart-weekend>] 
              [-m <max-dir-depth>]
              [-f]
              [-L]
              [-d <days-ago>]
              [-D <date-format>] 
              [-g] 
              [-h]

以下是每个标志的说明

- `-a`      - Specify author to restrict search to (name or email)
- `-w`      - Specify weekday range to limit search to (e.g. `git standup -w SUN-THU`)
- `-m`      - Specify the depth of recursive directory search
- `-L`      - Toggle inclusion of symbolic links in recursive directory search
- `-d`      - Specify the number of days back to include
- `-D`      - Specify the date format for "git log" (default: relative)
- `-h`      - Display the help screen
- `-g`      - Show if commit is GPG signed or not
- `-f`      - Fetch the latest commits beforehand

由于另一个问题被锁定(可能是错误的),我将把这个放在这里:

显示作者及其提交次数:

git shortlog -nse

查找特定USERNAME的所有提交:

git log --author=USERNAME --oneline --color=never | awk '{print $1}' | xargs git show