[wplug] A Git puzzle ....

Pat Barron pat at lectroid.com
Mon Aug 24 10:09:51 EDT 2015


Consider, if you will, the following scenario:

Assume there is some repo on GItHub that I want to make code 
contributions to (it could be anywhere else besides GitHub, too, but I'm 
just trying to nail this down as a concrete example....).  So, I fork 
the repo on GitHub, make some changes, push the changes back up to 
GitHub, and create a pull request.  This is all pretty standard.

The maintainer looks at the pull request, takes some of my changes, and 
doesn't take others.  And, does some additional development work in the 
(original) repo too.

So, now the state of the world is that the maintainer's repo contains 
some commits that my repo does not contain - and my repo contains some 
commits that are not in the maintainers repo.  I still want to continue 
making code contributions to the original repo, and I decide that what I 
really want to do at this point is abandon the changes I made that the 
maintainer didn't take, and get my fork into sync with the maintainer's 
repo.

What's the best way to do this?  Keep in mind that, at the moment, in my 
repo I do not have a remote defined for the maintainer's repo (I do have 
a remote defined for my forked repo in GitHub), but could certainly 
create one (and I understand that I will need to - but then I'll 
probably delete it later, since I don't have access to push directly to 
the maintainer's repo).  At the end of the process, I want the state of 
my repo to look like the state of the maintainer's repo, so that I can 
contribute other code changes against the state of the maintainer's code 
right now.  Simply deleting my repo and starting over is not an option, 
because that loses things in GitHub (like Issues) that I want to keep.  
So I really do need to perform a sequence of Git operations to bring my 
repo into sync with the maintainer's.

This is one of those kinds of things I've never really understood well 
about Git - being about to coordinate changes between independent repos....

--Pat.



More information about the wplug mailing list