Background: I have a project "original" in a VSTS-hosted git repo and wanted to create a similar project, so I forked the repo. I have no intention of merging from the fork to the original repo - they'll be 2 separate projects. The forked repo's master branch policy that requires pull requests, no direct pushes.
Now, whenever I create such a pull request, the default target is not fork>master but original>master. I always manually change it to fork>master, but it's annoying...
Questions:
The purpose of git fork repo is contribute to the upstream (original) repo. So the forked repo and the original repo always has relations between them.
And if you want to create a new repo (without any relation with the original repo), but with and same code and branches as the original repo, then you should create an empty git repo and push all the branches from the original repo into the new created repo instead of forking the original repo. Detail steps as below:
In VSTS web page, create a new git repo. Detail steps, you can refer the document create a repo using the web portal.
Assume the git repo name is myrepo and the URL is https://account.visualstudio.com/project/_git/myrepo
.
If you have not cloned the original git repo, you can clone the original git repo by:
git clone <original git repo URL>
Then checkout all the remote branches locally by the command:
git checkout <remote branchname>
In the local original git repo, add remote for the new created git repo and push all the branches to the new created git repo. Detail commands as below:
#In the local original repo
git remote add myrepo https://account.visualstudio.com/project/_git/myrepo
git push myrepo --all
Now all the branches are pushed into the new created git repo and it's separate with the original git repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With