doorman
doorman

Reputation: 16959

Azure git, syncing forked repo with master

I have a forked Azure git web project which I am developing in Visual Code. I want this project to reflect the latest code from the master it is forking from. The forked project should never be merged with the master since it is an independent version of the product.

What is the recommended way to fetch the latest code from the master?

Can I do this directly in VS Code or do I need to handle this within Visual Studio?

Azure explanation of handling forks:

https://learn.microsoft.com/bs-cyrl-ba/azure/devops/repos/git/forks?view=azure-devops&tabs=visual-studio#create-pr

Upvotes: 6

Views: 5954

Answers (1)

Mengdi Liang
Mengdi Liang

Reputation: 19036

Can I do this directly in VS Code or do I need to handle this within Visual Studio?

You can do the same sync fork to latest feature directly in Visual studio code. Just, seems no obvious button can for you do. So, here what I provide is another steps.

1) Open View -> Terminal, run below commands in it:

git remote add upstream https://{org}@dev.azure.com/{org}/{project}/_git/{repos}

git fetch upstream

enter image description here

Note, here the upstream repos link is the original repos that you forked from.

2) Change the panel to Source control, then click on three dots:

enter image description here

3) Select Pull from, and then pick the corresponding Upstream link you set above.

enter image description here

Now, you would see that all of remote changes are fetched successfully.

In fact, these are all map with the operation in VS. Just in VScode, these need to achieve via commands.

Upvotes: 8

Related Questions