Git push to new repository | Sameer Gurung

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 👍

Explore Other Notes

Newer

Colour safe

Another excellent tool for checking colour accessibility, but with the added bonus of creating viable palettes for you. These can then be filtered based on various criteria such as minimum WCAG […]

Older

Around the Tesla coils

The Daft Punk track Around the World performed on Tesla coils. Somehow this manages to be even more awesome than the summary, too (I still slightly think it's fake... somehow […]
  • 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 […]
  • Murray Adcock.
Journal permalink

Made By Me, But Made Possible By:

CMS:

Build: Gatsby

Deployment: GitHub

Hosting: Netlify

Connect With Me:

Twitter Twitter

Instagram Instragram

500px 500px

GitHub GitHub

Keep Up To Date:

All Posts RSS feed.

Articles RSS feed.

Journal RSS feed.

Notes RSS feed.