How can I combine my “Fix branch” with “Master branch” from Android Studio?

I created the application in Android Studio and integrated it with Git. While I commit and transfer my changes to the main branch.

Now I created a new branch (from the wizard) named "Fix1", and I committed and made my last changes to this branch. What are the next steps to merge Fix1 back with Master? Can I do this from an Android studio?

This is what I see as options in the bottom right git menu: Git options in Android Studio

+11
source share
2 answers

Yes, you can.

  • First you need to insert your code in your fix1 branch, which you have already done
  • How is your branch changed to master
  • Now from the top VCS control go to git -> pull and select the fix1 branch and click the pull button

Now it will merge your fix1 code to manage the branch

+12
source

In your case, just go back to the main branch, go back to the list of branches - click on the fix1 branch and click "merge with the current" - this will combine fix1 with the main one.

More general explanation:

First of all, make sure you commit your changes before the merge.

Suppose you have a branch named A and a branch named B, and you want to merge B with A, so you need to do the following:

  1. Make sure you are on branch A, you can see it by right-clicking on your project -> Git -> Repository -> branches. The current branch name will appear at the bottom of the list of branches (or at the top of the list marked in yellow from the latest version of Android-studio)

  2. From this list of branches, select the branch that you want to merge with the current branch, and select "Merge", in this case, select branch B and click merge.

  3. If there are no conflicts, you are done. If there are conflicts, then you need to resolve them - Android has a good tool for merging - however, you can easily do it yourself - conflicting files will be painted red - you will see conflict areas with both branches - delete the unwanted code - after resolving all conflicts you need to press CTRL + A to add them to git - and then commit your branch again -> Done.

+2
source

Source: https://habr.com/ru/post/1267003/


All Articles