使用gitlog时,如何按用户进行筛选,以便只看到该用户的提交?
当前回答
试试这个工具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
其他回答
试试这个工具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 log --author="that user"
如果使用GitHub:
转到分支机构单击提交
它将以以下格式显示列表
branch_x: < comment>
author_name committed 2 days ago
看到个人作者的承诺;单击authorname,在那里您可以看到该作者在该分支上的所有提交
这对gitlog和gitk都有效——这是查看历史的两种最常见的方式。您不需要使用整个名称:
git log --author="Jon"
将符合“乔纳森·史密斯”的承诺
git log --author=Jon
and
git log --author=Smith
也会起作用。如果不需要空格,引号是可选的。
如果您打算搜索所有分支,而不仅仅是当前提交的祖先,那么添加--all。
您还可以轻松匹配多个作者,因为正则表达式是此筛选器的基本机制。因此,要列出Jonathan或Adam的提交,可以执行以下操作:
git log --author="\(Adam\)\|\(Jon\)"
为了排除特定作者或一组作者使用正则表达式进行的提交(如本问题中所述),您可以结合--perl regexp开关使用负前瞻:
git log --author='^(?!Adam|Jon).*$' --perl-regexp
或者,可以使用bash和piping排除Adam编写的提交:
git log --format='%H %an' |
grep -v Adam |
cut -d ' ' -f1 |
xargs -n1 git log -1
如果要排除Adam提交(但不一定是作者)的提交,请将%an替换为%cn。有关这方面的更多详情,请参阅我的博客文章:http://dymitruk.com/blog/2012/07/18/filtering-by-author-name/
您甚至可以通过简单地使用用户名的一部分来简化这一点:
git log --author=mr #if you're looking for mrfoobar's commits
推荐文章
- 当我试图推到原点时,为什么Git告诉我“没有这样的远程‘原点’”?
- 如何从远程分支中挑选?
- 如何查看一个分支中的哪些提交不在另一个分支中?
- 如何取消在github上的拉请求?
- HEAD和master的区别
- GIT克隆在windows中跨本地文件系统回购
- RPC失败;卷度传输已关闭,剩余未完成的读取数据
- 我应该在.gitignore文件中添加Django迁移文件吗?
- 错误:您对以下文件的本地更改将被签出覆盖
- Git rebase—即使所有合并冲突都已解决,仍然会继续报错
- 在Git中,我如何知道我的当前版本是什么?
- 跟踪所有远程git分支作为本地分支
- 为什么要把Gradle Wrapper提交给VCS?
- 自定义SSH端口上的Git
- git如何显示不存在于.gitignore中的未跟踪文件