# How do I apply a single "change"

5 messages from 2006-01-08 to 2006-01-08. Participants: Luben Tuikov, Junio C Hamano, Andreas Ericsson, Linus Torvalds.
Thread: https://gitlist.dev/t/2996

## Luben Tuikov, 2006-01-08 00:31

Subject: How do I apply a single "change"
Message-ID: <20060108003114.4679.qmail@web31812.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/20060108003114.4679.qmail%40web31812.mail.mud.yahoo.com

```
Forgive me for the _incredibly stupid questions_,
but how do I apply a single "change", identified
by its SHA?  Either from one branch to the other or
remote?

I.e. I want to "integrate" only that change?

Alternatively, how do I apply the absolute output of
"git-format-patch".  I tried but whatever I tried with
complained that it couldn't find any email addressess.
(roll eyes here)

Thanks for the help,
   Luben

```

## Junio C Hamano, 2006-01-08 00:38

Subject: Re: How do I apply a single "change"
Message-ID: <7v7j9b8sgf.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v7j9b8sgf.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20060108003114.4679.qmail@web31812.mail.mud.yahoo.com>

```
Luben Tuikov <ltuikov@yahoo.com> writes:

> ... how do I apply a single "change", identified
> by its SHA?  Either from one branch to the other or
> remote?
>
> I.e. I want to "integrate" only that change?

$ git-cherry-pick $object_name

> Alternatively, how do I apply the absolute output of
> "git-format-patch".  I tried but whatever I tried with
> complained that it couldn't find any email addressess.
> (roll eyes here)

It is unclear what you mean by absolute output, but here is what
I regularly do:

$ git-format-patch -k -m --stdout from to | git am -3 -k

```

## Luben Tuikov, 2006-01-08 00:51

Subject: Re: How do I apply a single "change"
Message-ID: <20060108005152.46315.qmail@web31813.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/20060108005152.46315.qmail%40web31813.mail.mud.yahoo.com
In-Reply-To: <7v7j9b8sgf.fsf@assigned-by-dhcp.cox.net>

```
--- Junio C Hamano <junkio@cox.net> wrote:

> Luben Tuikov <ltuikov@yahoo.com> writes:
> 
> > ... how do I apply a single "change", identified
> > by its SHA?  Either from one branch to the other or
> > remote?
> >
> > I.e. I want to "integrate" only that change?
> 
> $ git-cherry-pick $object_name

Ok, so git searches the db (other branches, etc) and
does the job.  This worked for me.

How will I do this same thing but if the "change" is
on a remote repository?

> > Alternatively, how do I apply the absolute output of
> > "git-format-patch".  I tried but whatever I tried with
> > complained that it couldn't find any email addressess.
> > (roll eyes here)
> 
> It is unclear what you mean by absolute output, but here is what
> I regularly do:
> 
> $ git-format-patch -k -m --stdout from to | git am -3 -k

I did 
$ git-format-patch commit^ commit

and the usual 0001-blah-blah file got created.  Then
I tried to apply it, but whatever I tried it complained.
Will "git-am -3 -k" work without complaining there is
no "email field" or something?  (I cannot try it as
git-cherry-pick worked for me already.)

Thanks,
   Lunen

```

## Andreas Ericsson, 2006-01-08 01:19

Subject: Re: How do I apply a single "change"
Message-ID: <43C06892.2030709@op5.se>
URL: https://gitlist.dev/e/43C06892.2030709%40op5.se
In-Reply-To: <20060108005152.46315.qmail@web31813.mail.mud.yahoo.com>

```
Luben Tuikov wrote:
> --- Junio C Hamano <junkio@cox.net> wrote:
>>
>>$ git-cherry-pick $object_name
> 
> 
> Ok, so git searches the db (other branches, etc) and
> does the job.  This worked for me.
> 
> How will I do this same thing but if the "change" is
> on a remote repository?
> 

You can't. cherry-pick doesn't work on remote repos, so you need to pull 
that branch to a local one first.

> 
>>>Alternatively, how do I apply the absolute output of
>>>"git-format-patch".  I tried but whatever I tried with
>>>complained that it couldn't find any email addressess.
>>>(roll eyes here)
>>
>>It is unclear what you mean by absolute output, but here is what
>>I regularly do:
>>
>>$ git-format-patch -k -m --stdout from to | git am -3 -k
> 
> 
> I did 
> $ git-format-patch commit^ commit
> 
> and the usual 0001-blah-blah file got created.  Then
> I tried to apply it, but whatever I tried it complained.
> Will "git-am -3 -k" work without complaining there is
> no "email field" or something?  (I cannot try it as
> git-cherry-pick worked for me already.)
> 

You need to specify the '--mbox' (or '-m') for git-format-patch, 
otherwise it can't find author-info in the generated patch and it won't 
know who committed what.

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

```

## Linus Torvalds, 2006-01-08 02:24

Subject: Re: How do I apply a single "change"
Message-ID: <Pine.LNX.4.64.0601071823550.3169@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0601071823550.3169%40g5.osdl.org
In-Reply-To: <43C06892.2030709@op5.se>

```


On Sun, 8 Jan 2006, Andreas Ericsson wrote:
> 
> You can't. cherry-pick doesn't work on remote repos, so you need to pull that
> branch to a local one first.

"fetch", not "pull".

It's easy enough to get confused anyway, so we should be careful.

		Linus

```
