This is an IntelliJ plugin to prevent making commits without local user.name
and user.email
.
In runs as part of the standard 'commit' button action and shows an error message if this condition is not found.
Motivation is to prevent commits under the wrong mail address when working on multiple repositories (work, private, GitHub, BitBucket,...).
- Automatic check before each commit, shows yes/no warning dialog if no local name/mail are found.
- Manual check via "Tools" menu and "Check Local Git Config...".
- Check when opening a repository, shows a notification if no local name/mail are found.
This plugin is available via JetBrains Marketplace as Git Identity Checker.
- Invoke the
buildPlugin
Gradle task to create the plugin distribution - The resulting ZIP file is located in
build/distributions
and can be installed via "Install Plugin from Disk..." - Read more: https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html#building-distribution
- IntellijIDEA 2023.2.4 or later
- Written in Kotlin, Gradle, ...
- Open the project in IntelliJ, set breakpoints and click the debug icon next to "Run Plugin".
This will start the
runIde
gradle task, open a new IntelliJ Community Edition window and stop on breakpoints. - There is also a log available in the child IDE, menu 'Help', 'Open Log in Editor', look for lines containing "GitIdentityChecker".
- All the commit check logic is in
src/main/kotlin/com/github/OnCommit.kt
- The plugin components are registered in
src/main/resources/META-INF/plugin.xml
- The two other ways to check are in
OnStartup.kt
andOnMenuAction.kt
- Increase version in build.gradle.kts
- edit change-notes in src/main/resources/META-INF/plugin.xml
- Build a zip via
buildPlugin
target, appears in build/distributions/ - Upload manually via https://plugins.jetbrains.com/plugin/23050-git-identity-checker
- Create a commit + version tag and push to GitHub