Re: Pulling one commit at a time.

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

 



Nanako Shiraishi wrote:
Quoting Sanjiv Gupta <sanjiv.gupta@xxxxxxxxxxxxx>

I just wanted to know how can I pull one commit at a time from public
repository.
e.g.
when I first cloned from the public repo, it was at X. now it has
reached Y. I just want to pull x+1.

When your histories look like this:

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

instead of creating a single merge like this with "git pull":

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

you want to create a history like this?

      A---J             your 'master' (lacks V, W and Y)
     /   /
 ---X---U---V---W---Y   public 'master'

For that, 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.

You can repeat this final step as many times you want. For example, if you want create a history like this:

      A---J---K---L---M your 'master'
/ / / / / ---X---U---V---W---Y public 'master'

you can do so by repeating the last step for V, W and Y in turn.

In general the public history isn't necessarily a single straight line like this picture and it doesn't make sense to merge one at a time for all the commits on the public branch, but if that is what you really want to do, you can do so.

Excellent description. Thanks for that. I want to merge commits one by one because I want to run a regression suite on each commit and therefore know if any one is causing failures.

- Sanjiv

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