Skip to content

Instantly share code, notes, and snippets.

@junaidtk
Created November 9, 2021 05:28
Show Gist options
  • Save junaidtk/083cc795bb0b1518fd2e3c136461bc69 to your computer and use it in GitHub Desktop.
Save junaidtk/083cc795bb0b1518fd2e3c136461bc69 to your computer and use it in GitHub Desktop.
How to transfer a repository into a new repository using source tree
When we need to transfer/import a repository into new repository without loosing the all the prior commits.
Then follow the below steps.
1) Create a new repo with no any previous/initial commits like gitignore files or readme files.
Because this will create conflict with existing repo file of old repository.
2) Then clone the remote repo into a desired folder on your local system.
3) Checkout all the required remote branches in to the local branch.
Only checkouted branch will be available in the new repository
4) Then change the orgin url of the checkouted repo in the local system t new orgin url.
Navigate to cloned directory using
cd <cloned directory>
Then set the new orgin url
git remote set-url origin <new-repo-url>
5) If you have any changes, then you can do the changes and commit and push the changes to remote repo.
Or you can simply push the local repo into the remote.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment