tags:

views:

192

answers:

4
+3  Q: 

git partial pull

I am maintaining a repository A.

Another contributor has cloned A to another repository B.

Later, the other contributor added files F, which is irrelevant to me, into B.

Now I want to merge changes in B back to A, but without committing F. How to do so?

+3  A: 

Fetch the head and cherry-pick from there.

git remote add jessica git://jessica.com/repo.git
git fetch jessica master
git cherry-pick 235a5
...
wilhelmtell
A: 

The short answer is that you cannot "partially pull" with git.

However, you can pull the changes from B, and then use git-rebase(1) or git-filter-branch(1) to modify the commit(s) containing F before pushing to A. Keep in mind that this will change (relative to B) the hashes of the commit(s) you modify, so future merges attempted upon B will be less intelligent than usual.

Take a look at the Pro Git chapter on Rewriting History.

Joseph Spiros
A: 

Maybe this thread helps you: http://www.mail-archive.com/[email protected]/msg00653.html

HTH

Zsolt Botykai
A: 

you could do:

git checkout <remote_branch> <paths>

where <paths> is the files that you actually want. this is easiest if the files you want are in separate directories to the files you don't, as you can use wildcards.

alternatively, try:

git pull --squash

this may be a bit manual, as you then have to go and delete the files you don't want before committing, but it is also the only way to do it if the files you don't want have been added as part of the same commit that changed files you do want.

the (fairly major) downside is that you lose the commit history of the remote branch.

scomar