Re: Pulling one commit at a time.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nanako Shiraishi <nanako3@xxxxxxxxxxx> writes:

> When your histories look like this:
>
>       A                 your 'master'
>      /
>  ---X---U---V---W---Y   public 'master' (your 'origin')
>
> ... you can fetch first.
>
>  git fetch origin
>
> Then look at the history in gitk
>
>  gitk master origin
>
> And find the commit you are interested in merging (U in the above
> picture). And merge it.
>
>  git merge origin~3
>
> Replace "origin~3" in the example above with whatever commit you want to
> merge the entire history leading to it.

A good description.  Thanks, Nana.

Novice readers should notice the careful wording used here.  She says
"merge the entire history leading to it" instead of simply "merge the
commit".  Merging a commit in git always means merging the entire history
leading to that commit, so they mean the same thing to people who know git
well, but it avoids a misunderstanding that, if you did

    $ git merge V

it might apply the effect of only V, ignoring what U did, on top of your
current state A.  It doesn't.

       A-------M         your 'master'
      /       / 
  ---X---U---V---W---Y   public 'master' (your 'origin')

To create a commit that has only the effect of a single commit, you would
need to cherry-pick it.

    $ git cherry-pick V

will give you

       A-------V'        your 'master'
      /
  ---X---U---V---W---Y   public 'master' (your 'origin')

where "git diff A V'" is a moral equivalent of "git diff U V".
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]