Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(log): add option to search for header or body to
git log
Note to reviewer: I hate the name `--header-or`! Please help me come up with a better name. 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 --header-or ``` 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" --header-or` 4. expect to see both commits Signed-off-by: Max 👨🏽💻 Coplan <[email protected]>
- Loading branch information