# applying and committing patches in a single git command

6 messages from 2008-07-15 to 2008-07-15. Participants: Erez Zilber, Stephan Beyer, Boaz Harrosh, Andreas Ericsson.
Thread: https://gitlist.dev/t/14461

## Erez Zilber, 2008-07-15 08:50

Subject: applying and committing patches in a single git command
Message-ID: <ce513bcc0807150150l783e9ff1kd7780dc59f4b5a3d@mail.gmail.com>
URL: https://gitlist.dev/e/ce513bcc0807150150l783e9ff1kd7780dc59f4b5a3d%40mail.gmail.com

```
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, 2008-07-15 08:52

Subject: Re: applying and committing patches in a single git command
Message-ID: <20080715085228.GA6244@leksak.fem-net>
URL: https://gitlist.dev/e/20080715085228.GA6244%40leksak.fem-net
In-Reply-To: <ce513bcc0807150150l783e9ff1kd7780dc59f4b5a3d@mail.gmail.com>

```
Hi,

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?

git-am is exactly what you want.

Regards.

-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

```

## Boaz Harrosh, 2008-07-15 08:53

Subject: Re: applying and committing patches in a single git command
Message-ID: <487C659E.60606@panasas.com>
URL: https://gitlist.dev/e/487C659E.60606%40panasas.com
In-Reply-To: <ce513bcc0807150150l783e9ff1kd7780dc59f4b5a3d@mail.gmail.com>

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

```

## Erez Zilber, 2008-07-15 09:46

Subject: Re: applying and committing patches in a single git command
Message-ID: <ce513bcc0807150246g790ca009vc0a76bd6ef0aac9b@mail.gmail.com>
URL: https://gitlist.dev/e/ce513bcc0807150246g790ca009vc0a76bd6ef0aac9b%40mail.gmail.com
In-Reply-To: <487C659E.60606@panasas.com>

```
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?
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, 2008-07-15 10:00

Subject: Re: applying and committing patches in a single git command
Message-ID: <487C752E.4090707@op5.se>
URL: https://gitlist.dev/e/487C752E.4090707%40op5.se
In-Reply-To: <ce513bcc0807150246g790ca009vc0a76bd6ef0aac9b@mail.gmail.com>

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

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

```

## Erez Zilber, 2008-07-15 11:03

Subject: Re: applying and committing patches in a single git command
Message-ID: <ce513bcc0807150403v75233737w127719dd30e48176@mail.gmail.com>
URL: https://gitlist.dev/e/ce513bcc0807150403v75233737w127719dd30e48176%40mail.gmail.com
In-Reply-To: <487C752E.4090707@op5.se>

```
On Tue, Jul 15, 2008 at 1:00 PM, Andreas Ericsson <ae@op5.se> wrote:
> 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.

```
