When using git log
, how can I filter by user so that I see only commits from that user?
相关问题
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
- Upload file > 25 MB on Github
相关文章
- 请教Git如何克隆本地库?
- What is the tortoisehg gui equivalent of doing “hg
- How to use Mercurial from Visual Studio 2010?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is it possible to do a “destroy history” in TFS?
- Is there a version control system abstraction for
You can use either = or "space". For instance following two commands return the same
On github there is also a secret way...
You can filter commits by author in the commit view by appending param
?author=github_handle
. For example, the link https://github.com/dynjs/dynjs/commits/master?author=jingweno shows a list of commits to the Dynjs projectIf you want to filter your own commits:
If using GitHub:
it will show list in below format
This works for both
git log
andgitk
- the 2 most common ways of viewing history. You don't need to use the whole name.will match a commit made by "Jonathan Smith"
and
would also work. The quotes are optional if you don't need any spaces.
Add
--all
if you intend to search all branches and not just the current commit's ancestors in your repo.You can also easily match on multiple authors as regex is the underlying mechanism for this filter. So to list commits by Jonathan or Adam, you can do this:
In order to exclude commits by a particular author or set of authors using regular expressions as noted in this question, you can use a negative lookahead in combination with the
--perl-regexp
switch:Alternatively, you can exclude commits authored by Adam by using
bash
and piping:If you want to exclude commits commited (but not necessarily authored) by Adam, replace
%an
with%cn
. More details about this are in my blog post here: http://dymitruk.com/blog/2012/07/18/filtering-by-author-name/gives you the manpage of git log. Search for "author" there by pressing / and then typing "author", followed by Enter. Type "n" a few times to get to the relevant section, which reveals:
as already suggested.
Note that this will give you the author of the commits, but in Git, the author can be someone different from the committer (for example in Linux kernel, if you submit a patch as an ordinary user, it might be committed by another administrative user.) See Difference between author and committer in Git? for more details)
Most of the time, what one refers to as the user is both the committer and the author though.