Lowest storage way to create a domain branch with clean history?

58 Views Asked by At

How can I create a new domain branch without duplicating revision history? By domain branch, I mean something like "mac", "windows", "serialization", configuration, or another domain of the application — larger than any feature, but smaller than the application proper. Some argue feature branches may be an anti-pattern. Regardless, it's useful to logically group feature revisions in a domain branch. How can this be done with a fresh revision history, so that the first commit is just a squash from master?

For "release", it's sufficient to just squash every merge from master, since "release" never merges back to "master". The other are upstream of master, but must be created from master and have its prior history by default. I can do it with git checkout master && git switch --orphan <domain> && git checkout master -- .gitignore && git add . && git commit -m "create new domain branch <domain>" && git push --set-upstream origin <domain> && git merge --squash master -m "merge changes from master to domain branch <domain>" --allow-unrelated-histories && git push but that doesn't define the initial commit as a squash in terms of master — it's an unrelated history. That nearly doubles the size of my repo, which is unacceptable once, let alone for multiple domains. Is there a way to do this without ballooning my repository?

0

There are 0 best solutions below