Can I add a cordova plugin based on a Git branch?

If the plugin is not registered at registry.cordova.io but is located in another git repository, you can specify the git URL:

$ cordova plugin add https://github.com/apache/cordova-plugin-console.git

The git example above fetches the plugin from the end of the master branch, but an alternate git-ref such as a tag or branch can be appended after a # character:

$ cordova plugin add https://github.com/apache/cordova-plugin-console.git#r0.2.0

If the plugin (and its plugin.xml file) is in a subdirectory within the git repo, you can specify it with a : character. Note that the # character is still needed:

$ cordova plugin add https://github.com/someone/aplugin.git#:/my/sub/dir

You can also combine both the git-ref and the subdirectory:

$ cordova plugin add https://github.com/someone/aplugin.git#r0.0.1:/my/sub/dir

Reference: https://cordova.apache.org/docs/en/3.3.0/guide/cli/index.html


If the project's github repository is branched properly, then you should be able to install the plugin using the specific branch in the github out of the box.

cordova plugin add https://git.example.com/myproject#branch_name 

Have look at Cordova connect plugin for instance where there is a provision to install versions older than 1.6.0 using sdk_1.3 branch just like the way you wanted. Hope it helps.