使用gitlog时,如何按用户进行筛选,以便只看到该用户的提交?
当前回答
由于另一个问题被锁定(可能是错误的),我将把这个放在这里:
显示作者及其提交次数:
git shortlog -nse
查找特定USERNAME的所有提交:
git log --author=USERNAME --oneline --color=never | awk '{print $1}' | xargs git show
其他回答
我的案例:我使用的是源代码树,我遵循了以下步骤:
按下CRL+3已更改下拉列表作者键入名称“Vinod Kumar”
如果使用GitHub:
转到分支机构单击提交
它将以以下格式显示列表
branch_x: < comment>
author_name committed 2 days ago
看到个人作者的承诺;单击authorname,在那里您可以看到该作者在该分支上的所有提交
试试这个工具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
一种可能的替代方法是使用名为mergestat的工具,该工具允许您针对repo中的提交历史运行SQL查询(除其他外)。
mergestat "SELECT * FROM commits WHERE author_name LIKE '%Jon%'"
它有点冗长,但可以提供灵活性,以通用的方式具体查找您要查找的内容。
例如,过滤掉合并提交,仅显示过去一年中特定作者的提交:
mergestat "SELECT * FROM commits WHERE author_name LIKE '%Jon%' WHERE author_when > DATE('now', '-1 year') AND parents < 2"
完整披露:我是项目的维护者:)
您甚至可以通过简单地使用用户名的一部分来简化这一点:
git log --author=mr #if you're looking for mrfoobar's commits
推荐文章
- 为什么我需要显式地推一个新分支?
- 如何撤消最后的git添加?
- Rubymine:如何让Git忽略Rubymine创建的.idea文件
- Gitignore二进制文件,没有扩展名
- Git隐藏错误:Git隐藏弹出并最终与合并冲突
- 了解Git和GitHub的基础知识
- 没有。Git目录的Git克隆
- Git与Mercurial仓库的互操作性
- 忽略git中修改(但未提交)的文件?
- “git restore”命令是什么?“git restore”和“git reset”之间有什么区别?
- Git合并与强制覆盖
- Git拉另一个分支
- 在Bash命令提示符上添加git分支
- 如何更改Git日志日期格式
- git pull -rebase和git pull -ff-only之间的区别