git mirroring to GitHub and filtering private files -
currently working on project. want open-source our day-to-day commits full info (author, etc...) while filtering out specific private folders.
let's commit a/file1 , b/file2 in branch master, have mirrored on github b folder filtered (this commit have a/file1).
one way thinking remote update hook that:
- list new commits added newref (let's lastfoundcommit..newref)
- amend commits 1 one (from lastfoundcommit newref) remove unwanted files
- in process, might create local master-filtered branch (if helps have locally)
- push branch public repository
- somehow keep mapping of commit id between private , public commits, compute "lastfoundcommit" on next push
ideally go both way (i.e., nice if import github branches , pull requests , have them "rebased" on top of our private repository, either automatically or simple process -- not hard rebase).
this similar git-subtree can do, except not extract subdir filter various files instead.
does seem feasible? or other suggestion? (maybe based on git filter-branch? or other existing tool/script might me?)
note: submodule not viable option, might sparse , in way much. also, list of "private" files might extend/change on time.
your plan fine, except should use git filter-branch
rewrite commits. filter-branch
command designed purposes these , gives maximal power rewrite commits in way desire.
it pretty easy have scripts supply filter-branch
record commit mapping old new.
that said, though submodules aren't viable option, in opinion using "private" folder @ top level separately hosted git repository better idea history rewriting you're proposing. it's less error prone, easier implement, , easier understand.
Comments
Post a Comment