Detecting branch switches

Hi all,

is there way to get notified about a branch switch? Usually, i use git on command line an i'd like to be able to start some actions in my plugin in case the branch is switched.

Thanks in advance
  thana

3 comments

For Git, you can use the GitRepositoryChangeListener interface and keep track of the return value of GitRepository.getCurrentBranch().

0

Hi Dmitry,
thx for your quick reply :)

So my plugin would have to depend on the git4idea plugin? How would i express this dependency in the plugin.xml?

0

Yes. The dependency tag would be <depends>Git4Idea</depends>
You'll also need to add the jars of the Git plugin to the classpath of your IntelliJ IDEA SDK.

0

Please sign in to leave a comment.