nuprap
nuprap

Reputation: 415

How to completely replace master with another branch in Azure DevOps

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?

Upvotes: 6

Views: 6866

Answers (1)

Shayki Abramczyk
Shayki Abramczyk

Reputation: 41575

  1. Clone the repo to your local machine.

    git clone {repo url}

  2. Go to the local repo and move to the secondary branch.

    git checkout {secondary branch}

  3. Copy all the content - Ctrl+A, Ctrl+C.

  4. Move back to master branch.

    git checkout master

  5. Paste the files (and replace existing files) Ctrl+V.

  6. Commit the changes.

    git add .

    git commit -m "update master"

  7. Push the changes to Azure DevOps.

    git push

Now the master branch updated with the content of the secondary branch.

Upvotes: 8

Related Questions