git - Gihub Pages: How to merge between two (forked) repositories? -
i have website (example.org) hosted on github pages. content in master branch of "production" repository of "example" organization.
- example/production:master
- => git example.org
i have fork of repository in personal account repository "staging" create content (in branch master feature branches) , prepare publication. published on github pages (as personal.github.io/example.org)
- personal/example.org:master
- (fork of example/production:master)
- => personal.github.io/example.org
this bit complicated setup required repository can have 1 branch published on github pages under 1 url. publicly available url work-in-progress, need have fork on personal account.
in order works, have delete cname file in fork (otherwise tries publish same domain, doesn't work in use) , change same values in _config.yml file jekyll (so internal navigation on site works, tracking codes).
(i can't put these file .gitignore because wouldn't in repository, used github pages directly...)
when try create pull request on "production" changes "staging" these changes cname , _config.yml merged - breaking example.org in process.
so right cherry picking individual commits "staging" "production" - real pain.
is there way keep 1 commit have on "staging" out of merge?
the solution above question has 2 steps:
change domain of fork
personal.github.io/example.orgstaging.example.orgcname file doesn't have delete has have different content,staging.example.org.to able have different files in both repos while still think merged, have following:
assume have our
productionrepo ,stagingrepo both checked out locally, being identical (and having samecname,_config.yml). check outstaging, make changes files , commit , push them.if normal merge
production, change merged over.but run these commands:
git checkout production git merge --strategy=ours staging git push production production:master(source)
--strategy=oursmakes sure during merge,productionfile remain unchanged. commit still marked merged.if want, can edit commit message between step 2 , 3 bit more descriptive did: merged 2 branches, made keep "our" (in case:
production) version of files.
so git files merged, although kept content. long don't touch them again, these files stay different count "merged".
Comments
Post a Comment