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`
  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.

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

Reply via email to