Creating a git repository on New Project generation from a plugin
I have built an IntelliJ plugin that generates a gradle project using file templates and imports it using an implementation of the JavaModuleBuilder.
As part of this process I would also like to initialise a git repository, set it's upstream and create a new branch for the user. Is there a simple way to do this?
I have added the git4idea plugin to the dependencies and in plugin.xml but regardless of what methods I call on it I can't see it having an affect on the project generated. Currently I am trying to use the methods in GitImpl, such as:
GitImpl().init(project, root)
This appears to have no affect but does give the warning: Activities registered via registerPostStartupActivity must be dumb-aware: com.intellij.ide.impl.NewProjectUril$Lambda...
Is there a more simple way to do this I am missing? I would really appreciate your help
Please sign in to leave a comment.
Please post full stacktraces alway.
And please never use *Impl classes directly, git4idea.commands.Git.getInstance().init(...) should do the same
Hi Yann Cebron thank you for replying, apologies for not including a stack trace, the code I had written didn't throw any errors directly (the error I reported above is caused by something else) it just had no affect on the project generated.
All I want to do is run these basic Git commands when generating the project:
Is that possible by calling the commands provided by git4idea? Any documentation or examples would be incredibly helpful, I really appreciate your help!
This should be possible using above mentioned API. There are plenty of usages inside IntelliJ Community sources.
Here's list of 3rd party plugins extending Git functionality in some way as other possible reference https://plugins.jetbrains.com/search?products=androidstudio&products=clion&products=dbe&products=go&products=idea&products=idea_ce&products=idea_edu&products=mps&products=objc&products=phpstorm&products=pycharm&products=pycharm_ce&products=pycharm_edu&products=rider&products=ruby&products=webstorm&search=git&shouldHaveSource=true