[PATCH] git-grep.txt: add "git ack" alias to Examples section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The alias was from René Scharfe's Google+ post [1]. For reference when
the Internet (or Google) is down:

    While grep is an indispensable tool if you're working with text
    files, some aspects of it could be improved. ack (or ack-grep, as
    it's called on Debian) has a few nice ideas in this regard. I
    especially like its presentation of search results from multiple
    files, which leaves more space for the actual file contents.

    And with the upcoming release 1.7.7 of git, its built-in grep
    command can dress up like ack and show search results in that
    nicer way, too. Run this (single line) command to add an alias
    that you can call as "git ack" ...

[1] https://plus.google.com/104164106444631459594/posts

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
---
 One of the few things I like about Clearcase is the examples section
 in their man pages, which contain very practical and often used
 commands. So I'd like to do the same way to git: start adding
 examples that are useful, not just ones that demonstrate difficult
 concepts or use cases.
 
 Those often used commands are likely popular aliases on the Internet.
 The next one that comes to mind after "git ack" is "git lol". We
 probably won't add them all. Certain concensus is needed to keep
 examples from becoming a encyclopedia.

 Good or bad move?

 Documentation/git-grep.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 8497aa4..a4881e5 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -269,6 +269,12 @@ Examples
 	Looks for a line that has `NODE` or `Unexpected` in
 	files that have lines that match both.
 
+`git -c color.grep.filename='bold green' -c color.grep.match='black yellow' grep --break --heading -n pattern`::
+	Searches for `pattern` and produces output similar to ack(1).
+	Alternatively you could add an alias for frequent use:
++
+`git config --global --add alias.ack "-c color.grep.filename='bold green' -c color.grep.match='black yellow' grep --break --heading -n"`
+
 GIT
 ---
 Part of the linkgit:git[1] suite
-- 
1.8.2.83.gc99314b

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]