hecko84
hecko84

Reputation: 1324

Is there a way to use git push-option in intellij?

Is there a way in IntelliJ to specify the push-option parameter while doing a git push? I use GitLab CI and to skip the CI you could pass skip ci as a push-option parameter. As I don't see this feature in Intellij I have to put it in the commit message, but this means that for this exact commit I will never be able to run the CI process

Upvotes: 3

Views: 1759

Answers (3)

Hakeem Wahab
Hakeem Wahab

Reputation: 128

Intellij does not give the ability to add custom push options. But you can use this plugin that I developed for this reason: https://plugins.jetbrains.com/plugin/23413-git-custom-push

Usage:
After installing the plugin, you will have a new button "Push with options..." in the commit tool window and Git menu.
After commiting your changes, you can click on the new button "Push with options..." and then a dialog well appear with some predefined push options (checkboxes) and a text field if you want to add another custom option.

There are some predefined push options. For example: -o ci.skip to skip gitlab CI pipeline

enter image description here

Upvotes: 2

Martin Melka
Martin Melka

Reputation: 7789

It is still not possible to specify the options.

But as a workaround for the GitLab CI case, you can instruct it to skip CI by adding a "command" to the commit message of the latest commit you are pushing:

$ git commit -m "Some information

[skip ci]
"

$ git push   # CI will not be triggered

However, this causes a bug if you are also using GitLab ChatOps integration with Slack slash commands: https://gitlab.com/gitlab-org/gitlab/-/issues/328790

Upvotes: 3

Ruslan Kuleshov
Ruslan Kuleshov

Reputation: 2415

If the options are always the same, you could set them via the push.pushOption in git config and it will work when pushing from the IDE

There is a feature request for --push-option support, please vote: https://youtrack.jetbrains.com/issue/IDEA-202210

Upvotes: 4

Related Questions