git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Thomas Badie <thomas.badie@gmail.com>
Cc: Jan Engelhardt <jengelh@inai.de>, git@vger.kernel.org
Subject: Re: A new way to get a sha1?
Date: Mon, 30 Jul 2012 12:51:47 -0400	[thread overview]
Message-ID: <20120730165147.GD16701@sigill.intra.peff.net> (raw)
In-Reply-To: <CAFjFENqGTumBRkDX4vJjQhGz0CrEC1VU1cDHWCERywa8vjVbRw@mail.gmail.com>

On Mon, Jul 30, 2012 at 06:40:12PM +0200, Thomas Badie wrote:

> I understand your opinion. My solution was a easier way to make your
> proposition about `git log --oneline`, because I don't want to copy these
> 6 numbers by hand. I'd prefer select the right line simply.
> 
> My solution is intended for people who just use git, and whatever their
> environment (Unix, Windows...) because all is contained in git.
> 
> But I clearly agree that there is a lot of other solutions by using external
> tools.  But IMHO, it is preferable that I just have to add a `-i' to a command
> to make this choice simply, and not having to use my WM for this kind of task.

I am pretty mouse-averse, and I find a nice solution to these sorts of
interactive-selection problems is to use your editor. In its most basic
form, something like:

  git log --oneline >tmp
  $EDITOR tmp ;# and delete everything you don't want
  git cherry-pick `cat tmp`

assuming you are proficient with your editor, finding the entry you want
and deleting all of the unwanted lines should be just a few keystrokes.
And you can simplify it with a script like this:

  $ cat `which vpipe`
  #!/bin/sh
  trap 'rm -f $tmp' 0
  tmp=`mktemp vpipe-XXXXXX` &&
  cat >$tmp &&
  ${EDITOR:-vi} $tmp </dev/tty >/dev/tty &&
  cat $tmp

which you can then use like:

  git cherry-pick `git log | vpipe`

I know that sort of thing is not for everyone (you have to really like
your editor), but I thought I'd share in case it is useful.

-Peff

  reply	other threads:[~2012-07-30 16:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30 12:11 A new way to get a sha1? Thomas Badie
2012-07-30 12:28 ` Jan Engelhardt
2012-07-30 15:45   ` Junio C Hamano
2012-07-30 16:57     ` Thomas Badie
2012-07-30 18:16     ` Martin Langhoff
2012-07-30 18:29       ` Junio C Hamano
2012-07-30 18:42         ` Martin Langhoff
2012-07-30 18:40       ` Andreas Schwab
2012-07-30 16:40   ` Thomas Badie
2012-07-30 16:51     ` Jeff King [this message]
2012-07-30 17:33       ` Thomas Badie
2012-07-30 17:55         ` Andreas Schwab
2012-07-30 12:41 ` Sitaram Chamarty
2012-07-30 16:49   ` Thomas Badie
2012-07-30 15:57 ` Thomas Rast
2012-07-30 17:17   ` Thomas Badie

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=20120730165147.GD16701@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jengelh@inai.de \
    --cc=thomas.badie@gmail.com \
    /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).