git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH] git-grep.txt: add "git ack" alias to Examples section
Date: Wed, 25 Sep 2013 20:49:16 +0700	[thread overview]
Message-ID: <1380116956-12091-1-git-send-email-pclouds@gmail.com> (raw)

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@gmail.com>
---
 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

                 reply	other threads:[~2013-09-25 13:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1380116956-12091-1-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=rene.scharfe@lsrfire.ath.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).