In this article, we learn how to rebase current branch into main/dev branch in Visual Studio using git. I will show how to do it, and just follow the steps clearly.
This article is to feature how to rebase your current branch into your updated main or dev branch in Visual Studio using git. For more articles about git just click this link.
GIT is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development.
Branch is a set or pack of code changes with a unique name. Each repository can have one or more branches. Ex. Main or Prod branch for the main branch and always updated and up running environment branch. Dev branch for the development environment where developer and engineers doing coding, redesign, remodel for the better enhancement of the system and etc.. UAT branch where Tester/QA Engineers doing for User Acceptance Testing (UAT) before going to Prod environment.
Rebase is one of many Git utilities, and one of the two Git utilities that specializes in integrating changes from one branch onto another. The other changes integration utility is Git Merge.
In my case, I have branches listed below;
- CurrentBranch – which is my current branch or where I do have coding update and changes.
- Dev – is a Dev environment branch where we assume in this case that developers, engineers and programmer where basing there main source of code. And what we used to rebased it to CurrentBranch .
- Main – Branch mainly up and running and used for production.
- UAT – is a User Acceptance Testing (UAT) environment where Tester/QA engineers doing testing the software.
We want to rebase the CurrentBranch to dev branch. The main reason why we do rebase the branch because in the real world or development, In one project or system has 3 or more developers development in the same time with different task. In case your co-developer are making Pull Request (PR) and its been approved to merge the dev branch environment. Your CurrentBranch is not latest or updated to the base branch which is the dev branch environment. That time we do rebase so that our CurrentBranch is updated.
Rebasing the branch help you to lessen the error or conflict during your Pull Request (PR) period.
To do execute the Rebase Branch make sure that your lookup or base branch is updated, to make sure just fetch and pull changes in that branch.
Reselect your current branch in my case is CurrentBranch the name of the branch. Right click the base branch “DEV” and select “Rebase Current Branch onto“.
Confirmation will pop up and just click yes.
After the process, you will see like this, And normally the outgoing and incoming will have a numbers of commits show it if you branch if outdated and the base branch has merged new updated changes.
What you will do is to pull the incoming and push the outgoing. In some cases there are conflict changes that you need to resolved first before proceeding the next steps.
Thank you for visiting my blog site. Hoping you learn more here. please feel free to comment and suggest if there is need to enhance and update. thank you.
In this article, we learn how to rebase current branch into main/dev branch in Visual Studio using git. I will show how to do it, […]
In this tutorial I prepared to branches which is "master" and "New_Branch". New_Branch is created and used the previous article which is "Commit and Push […]
In this article, we learn how to Commit and Push changes to remote repo using Git in Visual Studio . I will show how to […]
In this article, we learn how to Push local branch to GitHub using Git in Visual Studio . I will show how to do it, and […]