From 5bc288aef8884985c2a6695c8fd626209cdd4df3 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Sun, 22 Nov 2015 19:58:55 -0600 Subject: [PATCH] Add Grep Over Commit Messages as a git til. --- README.md | 1 + git/grep-over-commit-messages.md | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 git/grep-over-commit-messages.md diff --git a/README.md b/README.md index 0d76f04..3d97784 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ smart people at [Hashrocket](http://hashrocket.com/). - [Dry Runs in Git](git/dry-runs-in-git.md) - [Excluding Files Locally](git/excluding-files-locally.md) - [Grab A Single File From A Stash](git/grab-a-single-file-from-a-stash.md) +- [Grep Over Commit Messages](git/grep-over-commit-messages.md) - [Ignore Changes To A Tracked File](git/ignore-changes-to-a-tracked-file.md) - [Intent To Add](git/intent-to-add.md) - [Last Commit A File Appeared In](git/last-commit-a-file-appeared-in.md) diff --git a/git/grep-over-commit-messages.md b/git/grep-over-commit-messages.md new file mode 100644 index 0000000..644f105 --- /dev/null +++ b/git/grep-over-commit-messages.md @@ -0,0 +1,14 @@ +# Grep Over Commit Messages + +The `git log` command supports a `--grep` flag that allows you to do a text +search (using grep, obviously) over the commit messages for that repository. +For the git user that writes descriptive commit messages, this can come in +quite handy. In particular, this can be put to use in an environment where +the standard process involves including ticket and bug numbers in the +commit. For example, finding bug `#123` can be accomplished with: + +```bash +$ git log --grep="#123" +``` + +See `man git-log` for more details.