过滤 git log 以仅显示我的更改

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8634356/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 12:35:27  来源:igfitidea点击:

Filter git log to show only my changes

gitversion-control

提问by Veera

How can I filter the git logto show only my changes (excluding the changes committed by other developers)?

如何过滤git log以仅显示我的更改(不包括其他开发人员提交的更改)?

回答by aleroot

You can filter the log by the author for example, so you can filter by your name :

例如,您可以按作者过滤日志,因此您可以按姓名过滤:

git log --author="YourName"

or by committer :

或提交者:

 git log --committer="YourName"

回答by Haralan Dobrev

You should use the --authorflag to the git-logcommand.

您应该--authorgit-log命令中使用该标志

Like so:

像这样:

git log --author="You Name"

Part of name is also working:

部分名称也有效:

git log --author=Name

However if you want to use in a generic script like in this tip, you could do it like this:

但是,如果您想在本提示中的通用脚本中使用,您可以这样做:

git log --author="$(git config user.name)"

You could then make an alias:

然后你可以创建一个别名:

git config --global alias.mylog '!git log --author="$(git config user.name)"'

You could then just type: git mylogand see your commits only.

然后你可以只输入:git mylog并只查看你的提交。