Git repo: internal and open source external branches -
what best way set git repo project company uses internally, want open-source (but potentially modified history)?
let's acme company has repo "supercoolproject". want open source it, don't want company name associated @ all. set github account under 1 of developer's names (or group, etc), , create repo. clone internal acme server. "acme" mentioned.
now comes problem - in given organization there developers understand open source , authorized push code public. there others don't understand nuances. when 1 of these makes commit, perhaps include company name or other proprietary information. or, make horrible commit can reverted internally (not rewriting history - i'm talking adding "revert" commit). but, don't want proprietary commits going out open source branches.
so, create "acme_internal_{dev,qa,production}" branches, , external "master" branch (and maybe others). what's best way keep in sync? want accept commits on open source repos. , want push (most of) internal commits out. there shouldn't go out.
it seems merging internal -> external bad thing because can't remove bad commits. rebasing external branches on internal ones done, seems "git rebase -i acme/acme_internal_dev" 1 time , modify history (change commit messages, remove commits, etc) can no longer rebase because 2 histories diverge. so, end cherry-picking internal commits out public branch , merging public branch internal tree? seems ugly because end duplicated commits internally (the original, , cherry-picked 1 went external , merged internal).
for purpose of question, let's assume internally acme wants avoid rewriting history (actually removing/modifying bad commmits) on internal branches.
there few measures can take leverage dvcs nature of dual repo want maintain.
first, never directly expose internal repo world (with idea of having "external" branch). there no such thing "external branch", "external -- or 'public' repos".
a possible setup have repo exposed world (to external contributors can push or pull from).
second, never push (from within acme) directly external repo: mistakes done, , don't control @ pace pulls done. ie, once push wrong stuff, swift correction might come late.
you need intermediate repo, still managed internally, review purpose. ie inspect has been pushed, and, if new commits ok, pull them external repo.
means external repo knows intermediate repo (it has listed in remotes), reverse not true (you cannot push mistake internal repo).
makes more explicit publication process (you must go external repo server , pull changes want publish, opposed of staying in familiar internal environment, , pushing carelessly)
make use, on intermediate repo (the 1 acme's developers can push review before publishing), of:
- pre-receive hooks (to make kinds of controls: if commit doesn't meet criteria publication, rejected , developer can rewrite history in his/her own repo).
again, rewriting history acceptable, long control within acme's developers repos. - content filter driver (see instance this question), in order not have version different contents between 2 kind of repo sensitive files (as in "something gitignore not git ignore").
Comments
Post a Comment