DEV Community

Cover image for How To Enable Real-Time Merge Conflict Detection In Android Studio
Sunny for GitLive

Posted on

How To Enable Real-Time Merge Conflict Detection In Android Studio

Ah, the dreaded resolve conflicts popup. You've finished crafting the perfect code, just a quick merge in of master (ahem, main) before you submit your PR, and then... đź’Ą

img-1-full.png

If only there was an early warning system for merge conflicts so you could be better prepared or even avoid the conflicts in the first place I hear you say? Well if you are an Android Studio user today is your lucky day!

Firstly, you'll need to install and set up GitLive (the latest version requires the Bumblebee Beta version of Android Studio). Then if you right click the gutter on Android Studio, you will see the option to “Show Other's Changes".

img-2-full.png

It will be disabled if the file open in the editor is not from git or there are no other changes to it from contributors working on other branches (aka you are safe from conflicts). If it's enabled there will be one or more change indicators in the gutter of the editor.

img-3-full-2.png

These will show you where your teammates have made changes compared to your version of the file and even update in real-time as you and your teammates are editing.

key indicators-dark.png

If you've made a conflicting change you will see the bright red conflict indicator. These conflicts can be uncommitted local changes you have not pushed yet or existing changes on your branch that conflict with your teammates’ changes.

Click your teammate’s icon in the gutter to see the diff between your version and theirs, the branch the offending changes are from, and the issue connected to that branch if there is one.

img-5-full-3.png

From this popup you can also cherry-pick your teammate’s change directly from their local version of the file. For simple conflicts this can be a quick way to resolve them as identical changes on different branches will merge cleanly.

Unfortunately, it's not always possible to resolve a conflict straight away but with the early warning, you'll be better prepared, avoiding any nasty surprises at merge time!

Check out this blog post or the GitLive docs if you want to learn more.

Top comments (7)

Collapse
 
sschneiderihrepvs profile image
sschneider-ihre-pvs

If only the online only option would disappear some day

Collapse
 
nbransby profile image
nbransby

whats the online option?

Collapse
 
sschneiderihrepvs profile image
sschneider-ihre-pvs

You can only use it online, if you have an on premise server you have to forward it to git live to be able to use it.
Not really good for working behind a firewall.

Thread Thread
 
sunnnygl profile image
Sunny

We hear you on this and will have something exciting to announce on this topic soon :)

Thread Thread
 
sschneiderihrepvs profile image
sschneider-ihre-pvs

any eta for that?

Thread Thread
 
sunnnygl profile image
Sunny

Our team is actively working on it, but haven’t given me a date l could share publicity yet. Will get back to you as soon as we are ready to announce more details :)

Collapse
 
steakeye profile image
Andrew Keats

Real-time merge conflict coupled with easy cherry picking is the real deal!