Hi, Phil. On Feb 22, 2015, at 4:52 AM, Phil Rosenberg wrote:
>> In addition to Alan's suggestion, another approach would be to setup a >> >local bare git repo that all your local machines could push/pull to/from. > > I tried this. As soon as I rebase a branch I am no longer able to push > it to the local bare repo because all the changes made since the last > push no longer exist and are replaced with new ones with different > guids. I started to write that I don't understand why you are not able to push to the local bare repo and I created much of the text below. In doing so, I realized the problem you are having. You are absolutely correct that you cannot push a rebased branch to the original branch because the commit IDs have changed. You will need to push the rebased branch to a new branch. There are two ways to do this. One is to create a "topic-rebase" branch from the "topic" branch, rebase the "topic-rebase" branch and then push the "topic-rebase" branch. The other way is to rebase the "topic" branch and give it a new name when you push it to the local bare repo. Below I show the first option, which I prefer because it keeps the original topic branch intact. 1) Start from the "master" branch that has commit "C" as the current HEAD: A--B--C <-{master, origin/master} 2) Create a "topic" branch and create commits "d" and "e" on it: A--B--C <-{master, origin/master} \ +--d--e <-{topic} 3) Push "topic" to your "local" repo: A--B--C <-{master, origin/master} \ +--d--e <-{topic, local/topic} 4) Using other local machines, push/pull the topic branch to/from the local repo and it ends up with additional commits "f" and "g": A--B--C <-{master, origin/master} \ +--d--e--f--g <-{topic, local/topic} 5) Fetch from origin, find that some else has pushed commits X and Y to master, and fast-forward your master to match it: git fetch origin git co master git merge --ff-only origin/master A--B--C--X--Y <-{master, origin/master} \ +--d--e--f--g <-{topic, local/topic} 6) Create and checkout a new "topic-rebase" branch that is based on the "topic" branch: git co -b topic-rebase topic A--B--C--X--Y <-{master, origin/master} \ +--d--e--f--g <-{topic, topic-rebase, local/topic} 7) Create and checkout a new "topic-rebase" branch that is based on the "topic" branch: git co -b topic-rebase topic A--B--C--X--Y <-{master, origin/master} \ +--d--e--f--g <-{topic, topic-rebase, local/topic} 8) Rebase the "topic-rebase" branch onto the new master, which will create new commits "d'", "e'", "f'", and "g'" that correspond to commits "d", "e", "f", and "g". These new commits will contain the same changes (assuming no conflicts with commits X and Y) as their counterparts and have the same log messages, but each commit will have different parent (e.g. d' has parent Y while d has parent C) and probably different trees (due to changes from X and Y) so they have different commit IDs. This step could involve conflicts that need to be resolved, but this assumes that wasn't necessary: git rebase origin/master A--B--C--X--Y <-{master, origin/master} \ \ \ +--d'--e'--f'--g' <-{topic-rebase} \ +--d--e--f--g <-{topic, local/topic} 9) Push "topic-rebase" to the local bare repository: git push local topic-rebase A--B--C--X--Y <-{master, origin/master} \ \ \ +--d'--e'--f'--g' <-{topic-rebase, local/topic-rebase} \ +--d--e--f--g <-{topic, local/topic} 10) Other local machines can fetch from the local bare repo and they will get the topic-rebase branch and all of its commits. Everything looks good, time to share with the world! 11) Fast forward "master" to "topic-rebase": git co master git merge --ff-only topic-rebase A--B--C--X--Y <-{origin/master} \ \ \ +--d'--e'--f'--g' <-{master, topic-rebase, local/topic-rebase} \ +--d--e--f--g <-{topic, local/topic} 12) Push master to the "origin" repo: git push origin master A--B--C--X--Y--d'--e'--f'--g' <-{master, topic-rebase, local/topic-rebase, origin/master} \ +--d--e--f--g <-{topic, local/topic} Hope this helps, Dave ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel