Super useful walkthrough on taking a branch from one repository and publishing it to another repository entirely (great for creating test repos or stripped-down example repos for bug isolation).
The tl;dr is as follows:
git checkout --orphan clean-branch # this is when you delete all unwanted files, rename package.json, simplify code etc. git add * git commit -m "Example repository" git remote add origin2 https://github.com/org-name/project-title git push origin2 clean-branch:main
⬆ That will create a new branch without any Git history; commit all files to that branch (so make sure you simplify the repository between these steps 😉); add a new origin to the existing repository (here named origin2
and linked to a dummy GitHub repository, but any name can be used and create the remote repo first); and finally, pushes your stripped-down branch to the main
branch of the new repo (again, if you use trunk
or anything else, change that here). Simple 👍