Sync is a combined operation of pulling remote changes and then pushing local ones. This operation synchronizes the commits on the local and remote branch.
1.In Team Explorer, select the Home button and choose Sync.
2.In Synchronization, select Sync.
3.Review the confirmation message when the sync operation completes.
When working in a branch, you may want to incorporate the latest changes from the master branch into your branch. There are two approaches you can use: rebase or merge.
To merge the latest changes from the master branch to your branch:
1.In Team Explorer, select the Home button and choose Branches.
2.Check out your target branch. Right-click the target branch, and choose Merge From.
3.Specify a Merge from branch, which is master in this example, and then select Merge.
If there are any merge conflicts, Team Explorer tells you now. Resolve the merge commits before the next step.
4.Enter a commit message and select Commit Staged.
5.When you're ready to push your local commits, including your new merge commit, to the remote server, choose Push from the Synchronization view.
In Team Explorer, go to the Branches view. Click Rebase. You'll see a prompt to rebase the changes from your current branch, and then a drop-down to specify which branch the changes in the current branch should be replayed on top of. If there is a conflict, resolve it just like you resolve merge conflicts in Visual Studio.
Stashing helps you to save uncompleted work so that you can reapply it to your local repo when needed. Stash works the same way a shelveset in TFVC works.
Prerequisites: You need Visual Studio 2019(not in VS2017 or before) to use stash functionality.
You have completed all the lessons in this chapter and have the code available in the Azure Git repository and opened a local repo in VS Code and in Visual Studio.
In Visual Studio, open the solution from the local repo and make a code change.
Then click the changes in Team Explorer; you will see the stash options on the commit changes page.
In the event that you want to stop tracking an upstream branch, go to the Branches page, right click on a local branch, and unset its upstream:
© 2021 Digcode.com