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?
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.
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
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With