[pacman-dev] git help - Was : [PATCH 1/2] Enabled new interactive prompt and updated some tests.

Dan McGee dpmcgee at gmail.com
Mon Feb 23 21:45:46 EST 2009


On Mon, Feb 23, 2009 at 9:55 AM, Aaron Griffin <aaronmgriffin at gmail.com> wrote:
> On Sun, Feb 22, 2009 at 10:20 PM, Dan McGee <dpmcgee at gmail.com> wrote:
>> On Sun, Feb 22, 2009 at 10:14 PM, Allan McRae <allan at archlinux.org> wrote:
>>> Dan McGee wrote:
>>>>
>>>> I never use git-merge when doing my own work, btw- I'm really not sure
>>>> that makes workflow easy at all, as I tend to cherrypick things around
>>>> on multiple working branches if I want to move patches.
>>>>
>>>
>>> So while we are getting git tutorials, do you mind giving an example command
>>> that does this.  I always end up in a mess when trying to do that...
>>
>> OK. So I'm busy reintegrating some of your guys' stuff into [master],
>> when I see a problem that I need to fix. I go ahead and fix it, make
>> my own commit...and then realize this fix should be on [maint].
>>
>> git log, look for the sha1 commit ID of the commit I want to move
>> git co maint
>> git chp <sha1>
>> profit!
>>
>> co? chp? what are those, you ask? git aliases are awesome:
>>
>> $ git config --list
>> alias.co=checkout
>> alias.chp=cherry-pick
>> alias.b=branch
>> alias.m=merge
>> alias.rf=checkout HEAD
>>
>> I think it is something like "git config alias.co checkout".
>>
>> I'd then go back and remove that commit from [master]. If it was still
>> the last thing I did, I'd "git reset --hard HEAD^". If it was further
>> back, rebase -i to the rescue and just delete the line.
>
> So when you cherry-pick, you actually then remove the commit from the
> original branch and rebase? I never thought of it that way, that
> actually cleans up some confusion I had with cherry-pick to begin
> with.

Something like that, yes. Of course, rewriting history shouldn't be
done unless the branches are private to you (or you haven't
shared/pushed them out yet).

cherry-pick is definitely a super-easy way to assemble a new branch to
test small pieces of things, or to throw away some commits you weren't
happy with.

-Dan


More information about the pacman-dev mailing list