Using Azure DevOps, there is a repo with valid code being maintained in a secondary branch. However, the master branch is multiple years out of date.
I want to obliterate the contents of master and overwrite it with the contents of the secondary branch.
I understand that mishandling this can cause serious namespaces issues and I would like to avoid that.
What method would you recommend for completely replacing master with a secondary branch in Azure DevOps?
Under your project repo, select Branches. On the Branches page, select More options next to the new default branch you want, and choose Set as default branch. After you set the new default branch, you can delete the previous default if you want.
Using the -f flag, your previous master is completely overwritten with develop , including its history.
Clone the repo to your local machine.
git clone {repo url}
Go to the local repo and move to the secondary branch.
git checkout {secondary branch}
Copy all the content - Ctrl+A
, Ctrl+C
.
Move back to master branch.
git checkout master
Paste the files (and replace existing files) Ctrl+V
.
Commit the changes.
git add .
git commit -m "update master"
Push the changes to Azure DevOps.
git push
Now the master
branch updated with the content of the secondary branch
.
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