Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio, Git and three ways merge

On Android Studio, I created a new branch from the master and commited the new branch two times. Then I checkedout the master and commited it one time. So I have two branches with two distinct endpoints and a common parent. Now I am trying a three ways merge: right click on the new branch, click on the new branch name, then merge, but appears a popup

Couldn't merge TestMergeBranch CONFLICT (content): Merge conflict in (... files' list ...)

and nothing more happens.

Thus I click on VCS menu, Git, Resolve conflicts. Then I click Accept Yours button to resolve the conflicts on selected files. The Resolve window disappears, and again nothing more happens.

Thus I go to re-add to stage the resolved files but the Add option is disabled.

Any hints?

(Android Studio 2.0 on Ubuntu 14.04)

--- It needs an android-studio-git Tag ---

like image 450
GPack Avatar asked Apr 12 '16 16:04

GPack


2 Answers

First checkout the branch you want to merge other branch(example if you want to merge the development to master then checkout master).

Right click on the branch which you want to merge to your checked out branch and use merge.

If you worked on the same files in the two branches it can't merge itself, hence throws a conflict.

Resolve the conflict manually

Add files to index(This will make it understand that conflicts are merged)

Commit the changes of the merge

Push to your remote.

like image 156
Vamsi Ravi Avatar answered Oct 02 '22 14:10

Vamsi Ravi


Add option is disabled

If you are referring to the "Add to VCS" option, it should be disabled as the file is already tracked by git (it is for new files)

Try a commit instead and select the files you have resolved for addition/commit from the commit change dialog.

like image 21
VonC Avatar answered Oct 02 '22 14:10

VonC