Re: A new way to get a sha1?
- From
Jeff King <peff@peff.net>
- Date
- Jul 30, 2012, 16:51 UTC
- Message-ID
- <20120730165147.GD16701@sigill.intra.peff.net>
- In-Reply-To
- <CAFjFENqGTumBRkDX4vJjQhGz0CrEC1VU1cDHWCERywa8vjVbRw@mail.gmail.com>
On Mon, Jul 30, 2012 at 06:40:12PM +0200, Thomas Badie wrote:
Show 10 quoted lines
> 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 $tmpwhich 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