- Take a parent repository
[email protected]:Example/example.git
- Take a child repository
[email protected]:Example/child.git
cd child;
git checkout master;
git remote add upstream [email protected]:Example/example.git;
git checkout -b parent;
git push -u origin parent;
git branch -f --track parent upstream/master;
git checkout parent;
git checkout -b parent-merge;
git rebase -i -s recursive -X theirs master;
From here I reword the first commit to be Example Website
and then fixup
the rest of the commits.
:%s/pick/fixup/g
- This will replace allpick
withfixup
This means there will only be one commit for the previous site, just do condense the reflogs.
If you need to revert older commits (that won't be affected by the parent) I'd suggest not squashing.
Then push.
git push origin parent-merge
;
This wont be an issue if the repo was empty before merge. At this point, you may want to review any files that have trailed from before the merge that are not needed. Would be interested to know about any good ways to remove these files easily, without having to go through everything.
Then PR into master.