Skip to main content

Platforms and Technology

Rebasing Changes in Visual Studio

Customer Intelligence

In this blog post, I will briefly describe the concept of rebasing and go over how it is done in Visual Studio.

 

Merging vs. Rebasing

When you are merging branches, you simply merge the latest dev branch into your current feature branch as shown in the diagram below.

Bp11 1 Letscloudy Merge

Unlike merging, rebasing “re”-bases the feature branch with the latest dev branch.

When you rebase, the latest changes in the current branch (‘f1’ & ‘f2’) are internally saved for a moment. The latest pull from the dev branch (‘d2’ commit) in the current branch is then re-based with a ‘d4’ commit and the internally saved commits (‘f1’ and ‘f2’) are added back.

B11 2 Letscloudy Rebase

 

Rebasing in Visual Studio

Let’s now look at how rebasing is done in Visual Studio.

Here is an overview of the process:

  1. Commit and sync the changes in the current branch.
  2. Rebase the current branch onto the ‘develop’ branch.
  3. Merge conflicts in the detached branch.

Let’s imagine you added the ‘f1’ and ‘f2’ features. Commit and sync the changes.

Bp11 3

Bp11 4

Go to the ‘Branches’ tab in the Team Explorer and rebase the current feature branch onto develop branch.

Bp11 5

Notice how a branch ‘Detached at {id}’ is created upon rebasing. This is a detached branch created internally for us to resolve conflicts.

Bp11 6

Accept merge and resolve any conflict that is generated.

Bp11 7

Return to the ‘Changes’ tab in the Team Explorer and click ‘Continue’ under ‘Rebase In Progress’.

Bp11 8

You will then notice you are back in the feature branch.

Bp11 9

You can now push the changes to your repository!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

David Hwang

David Hwang is an Associate Technical Consultant in the Sitecore/Microsoft Business Unit. He will be blogging about various concepts in technologies for beginners.

More from this Author

Follow Us
TwitterLinkedinFacebookYoutubeInstagram