forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
log: add option to search for header or body
Summary: This change adds a new option to `git log` that allows users to search for commits that match either the author or the commit message. This is useful for finding commits that were either authored or co-authored by a specific person. Currently, the best way to find a commit either authored or co-authored by a specific person is to use ```sh echo \ $(git log --author=Torvalds --pretty="%cd,%H\n" --date=iso-strict) \ $(git log --grep="Co-authored-by: .*Torvalds" --pretty="%cd,%H\n" --date=iso-strict) \ | sort -n --reverse \ | awk -F, '{print $2}' \ | tr '\n' '\t' \ | xargs git show --stat --stdin ``` This is a bit of a pain, so this change adds a new option to `git log`. Now finding either authors or co-authors is as simple as ```sh git log --author=Torvalds --grep=Torvalds --match-header-or-grep ``` Test plan: 1. create commit authored by A and co-authored-by B 2. create commit authored by B 3. run `git log --author=B --grep="Co-authored-by: B" --match-header-or-grep` 4. expect to see both commits Signed-off-by: Max 👨🏽💻 Coplan <[email protected]>
- Loading branch information
Showing
6 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters