One service in the monorepo must become its own repo, with its history.
AdvancedScenarioRebase, Cherry-pick and History Rewriting
Answer
Situation read → You need only the commits that touched services/billing, with paths moved to the root.
What I'd do →
- Fresh clone:
git clone --no-local monorepo billing && cd billing. git filter-repo --subdirectory-filter services/billing.- Add the new remote and push all branches and tags.
- In the monorepo, remove the directory and point to the new repo (or add it as a submodule or package dependency).
Why → filter-repo rewrites quickly and keeps only relevant history. Never run it on your working clone.
Interview tip → Plan CI, issue transfer, and CODEOWNERS for the new repo as part of the split.
More on Rebase, Cherry-pick and History Rewriting
Your PR branch has ten commits like "wip", "fix typo", "oops". How do you clean it up before review?BeginnerYou want the database migration commit to come before the code that uses it.BeginnerA critical fix on `main` must go to the `release/4.1` branch only.BeginnerYou must backport a feature made of 6 commits, including one merge commit.IntermediateBranch B was built on top of branch A. A was squash-merged into `main`, and now B shows A's commits again.IntermediateDuring review you get ten small change requests on old commits. How do you apply them cleanly?Intermediate