(Plugin development - open api) how to detect merge conflicts using git4idea?
Answered
Hello. I'm new to plugin development for IntelliJ and I'm trying to create a plugin dealing with git (using git4idea). I want my plugin to detect merge conflicts (whether the user used IntelliJ actions to merge or through the terminal like running the git merge command). I plan to display some information once a conflict has been found. Any advice on how to do this?
Please sign in to leave a comment.
You should check the GitStagingAreaHolder class. There is a StagingAreaListener listener available, which is invoked by the refresh method so you can track the changes in the repositories.
Having the GitRepository object available, you can fetch a loop through all conflicts:
Hi there,
Thanks for your help. Apparently, the class GitStagingAreaHolder does not exist with my current version of IntelliJ Idea (CE 2020.1.2), however, I discovered:
I'm assuming they're similar? Also, to clarify, would I need to make use of :
I'm not sure if GitConflictsHolder is what I need exactly, so I just wanted to make sure and ask here.
Thanks in advance!
Also, just another question to add to this: how can I determine the branches involved in the merge conflict?