Skip to main content



Copy code of Git Repo in to a different Git Repo with History Commits

 

1) Git clone 

git clone <url to Source repo> temp-dir


2) Check different branches

git branch -a

3) Checkout all the branches that you want to copy

git checkout branch-name

4) fetch all the tags 

git fetch --tags

5) Clear the link to Source repo

git remote rm origin

6) Link your local repository to your newly created NEW repository

git remote add origin <url to NEW repo>

7) Push all your branches and tags with these commands:

git push origin --all

git push --tags

8) Above steps complete copy from Source repo to New repo

Comments