This guide discusses the method of resetting the develop branch to the master branch.
How to Perform Reset Operation on Develop Branch to Master?
Follow the provided procedure to reset the develop branch into the master branch:
- Go to the Git repository.
- Show the local branches list.
- Switch to the βdevelopβ branch.
- Merge, commit and override the added changes by running the βgit merge –no-commit masterβ command.
- Execute the βgit checkout –theirs master .β command for checking out from develop to the master branch that contains the new rebased commits.
- Verify the resetting operation through Git log history.
Step 1: Switch to Root Directory
At first, execute the βcdβ command and move to the specified repository path:
Step 2: Show List of Branches
Use the βgit branchβ command to list all existing local branches:
From the below-given list, we have selected the βdevelopβ branch:
Step 3: Move to βdevelopβ Branch
Now, switch to the target βdevelopβ branch with the help of the following command:
Step 4: Merge and Commit Changes
To merge and commit the added changes, the below-stated command can be used:
In the above-stated command, the β–no-commitβ option is used to override the added results:
Step 5: Switch to βmasterβ Branch
After that, switch to the βmasterβ branch through the provided command:
Here, the β–theirβ flag refers to the target branch that contains the new commits which are rebased:
Step 6: Verify Reset Operation of βdevelopβ Branch to βmasterβ
Lastly, ensure whether the develop branch is reset to the master by running the βgit log .β command:
According to the below-given output, the develop branch is reset to the desired branch successfully:
We have efficiently provided the process of resetting the develop branch to the master branch.
Conclusion
To reset the develop branch into the master branch, first, go to the Git repository and check the list of all local branches. Then, switch to the βdevelopβ branch, run the βgit merge –no-commit masterβ command to merge, commit and override the added changes. Next, to contain the new commit to master, which is rebased in the develop branch, execute the βgit checkout –theirs master .β command. This guide illustrated the process of resetting the develop branch to the master branch.