threads / discuss / 14461

applying and committing patches in a single git command

Subject: applying and committing patches in a single git command

## tl;dr

6 messages between Jul 15, 2008 and Jul 15, 2008.

replies: 5people: 4as markdown or json

Erez Zilber· Jul 15, 2008, 08:50 UTC · lore
Hi,

Someone created a patch with git-format-patch and sent it to me. I would like to apply & commit the patch. If I use git-apply, it only patches my tree without committing it. Now, I need to copy the commit log, run git-commit and paste the commit log there. Is there a more intelligent way to do that?

Thanks, Erez

Stephan Beyer· Jul 15, 2008, 08:52 UTC · re: Erez Zilber · lore

Re: applying and committing patches in a single git command

Hi,
Erez Zilber wrote:
Show 7 quoted lines
> Hi,
> 
> Someone created a patch with git-format-patch and sent it to me. I
> would like to apply & commit the patch. If I use git-apply, it only
> patches my tree without committing it. Now, I need to copy the commit
> log, run git-commit and paste the commit log there. Is there a more
> intelligent way to do that?
git-am is exactly what you want.
Regards.
-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F
Boaz Harrosh· Jul 15, 2008, 08:53 UTC · re: Erez Zilber · lore

Re: applying and committing patches in a single git command

Erez Zilber wrote:
Show 11 quoted lines
> Hi,
> 
> Someone created a patch with git-format-patch and sent it to me. I
> would like to apply & commit the patch. If I use git-apply, it only
> patches my tree without committing it. Now, I need to copy the commit
> log, run git-commit and paste the commit log there. Is there a more
> intelligent way to do that?
> 
> Thanks,
> Erez
> 
git-am, can take all bunch of them at once
Boaz
Erez Zilber· Jul 15, 2008, 09:46 UTC · re: Boaz Harrosh · lore

Re: applying and committing patches in a single git command

On Tue, Jul 15, 2008 at 11:53 AM, Boaz Harrosh <bharrosh@panasas.com> wrote:
Show 16 quoted lines
> Erez Zilber wrote:
>> Hi,
>>
>> Someone created a patch with git-format-patch and sent it to me. I
>> would like to apply & commit the patch. If I use git-apply, it only
>> patches my tree without committing it. Now, I need to copy the commit
>> log, run git-commit and paste the commit log there. Is there a more
>> intelligent way to do that?
>>
>> Thanks,
>> Erez
>>
> git-am, can take all bunch of them at once
>
> Boaz
>
Thanks. I have 2 more questions:
1. How can I tell git-am to take a patch from an e-mail from a gmail account?
2. If I have the actual patch on my machine (not in an e-mail
message), I guess that I need something else (not git-am). Is there
anything like that?

Thanks, Erez

Andreas Ericsson· Jul 15, 2008, 10:00 UTC · re: Erez Zilber · lore

Re: applying and committing patches in a single git command

Erez Zilber wrote:
Show 20 quoted lines
> On Tue, Jul 15, 2008 at 11:53 AM, Boaz Harrosh <bharrosh@panasas.com> wrote:
>> Erez Zilber wrote:
>>> Hi,
>>>
>>> Someone created a patch with git-format-patch and sent it to me. I
>>> would like to apply & commit the patch. If I use git-apply, it only
>>> patches my tree without committing it. Now, I need to copy the commit
>>> log, run git-commit and paste the commit log there. Is there a more
>>> intelligent way to do that?
>>>
>>> Thanks,
>>> Erez
>>>
>> git-am, can take all bunch of them at once
>>
>> Boaz
>>
> 
> Thanks. I have 2 more questions:
> 1. How can I tell git-am to take a patch from an e-mail from a gmail account?

You can't, but you can save your gmail message to disc and pass the saved file to "git am" (don't use "git-am" over "git am"; we're trying to get away from that old format of typing).

> 2. If I have the actual patch on my machine (not in an e-mail
> message), I guess that I need something else (not git-am). Is there
> anything like that?
> 

git apply patchfile patch (-p1) < patchfile

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Erez Zilber· Jul 15, 2008, 11:03 UTC · re: Andreas Ericsson · lore

Re: applying and committing patches in a single git command

On Tue, Jul 15, 2008 at 1:00 PM, Andreas Ericsson <ae@op5.se> wrote:
Show 38 quoted lines
> Erez Zilber wrote:
>>
>> On Tue, Jul 15, 2008 at 11:53 AM, Boaz Harrosh <bharrosh@panasas.com>
>> wrote:
>>>
>>> Erez Zilber wrote:
>>>>
>>>> Hi,
>>>>
>>>> Someone created a patch with git-format-patch and sent it to me. I
>>>> would like to apply & commit the patch. If I use git-apply, it only
>>>> patches my tree without committing it. Now, I need to copy the commit
>>>> log, run git-commit and paste the commit log there. Is there a more
>>>> intelligent way to do that?
>>>>
>>>> Thanks,
>>>> Erez
>>>>
>>> git-am, can take all bunch of them at once
>>>
>>> Boaz
>>>
>>
>> Thanks. I have 2 more questions:
>> 1. How can I tell git-am to take a patch from an e-mail from a gmail
>> account?
>
> You can't, but you can save your gmail message to disc and pass
> the saved file to "git am" (don't use "git-am" over "git am";
> we're trying to get away from that old format of typing).
>
>> 2. If I have the actual patch on my machine (not in an e-mail
>> message), I guess that I need something else (not git-am). Is there
>> anything like that?
>>
>
> git apply patchfile
> patch (-p1) < patchfile
Thanks.

← back to recent threads