30

Is it possible to options for the Version Control's git commit command? If so, how? I'm a heavy user of the integrated source control UI in VS Code and I often need to provide extra options like --no-verify to the git commit. I still didn't figure out a way of doing this in VS Code.

Thanks!

8
  • I think your talking about git-config Commented Oct 25, 2018 at 10:17
  • There doesn't seem to be a way to set --no-verify as a default, so you'd need to write your own alias to do this, something like git config --global alias.mycommit 'commit --no-verify' Commented Oct 25, 2018 at 10:20
  • @Liam thanks for your reply. How can I make that alias my default commit command in VS Code? Commented Oct 27, 2018 at 14:21
  • You cant. Why does it make a difference? git commit vs git mycommit? Commented Oct 29, 2018 at 9:13
  • 3
    The point is to be able to use VS Code user interface instead of having to drop to the shell every time I need to do a commit. Thanks nevertheless @Liam! Commented Oct 29, 2018 at 16:52

1 Answer 1

28

With VSCode 1.50 (Sept 2020), there should now be more option for git commit in VSCode.

See PR 106335: Adds commands for --no-verify commit variants

This PR adds *NoVerify command variants for creating commits while skipping pre-commit and commit-msg hooks.

The commands are only displayed if the git.allowNoVerifyCommit option is set to true.
This type of commits requires additional confirmation (like git.pushForce does), which can be bypassed by disabling the git.confirmNoVerifyCommit option.

https://camo.githubusercontent.com/5c42dec32f31c5083e24299459693d5c9e5c9579/68747470733a2f2f692e696d6775722e636f6d2f585138304c57592e706e67


As illustrated with issue 110452, commit --no-verify will be in VSCode 1.52 (Nov. 2020)

Once you enable git.allowNoVerifyCommit, a bunch of commands will be available:

https://user-images.githubusercontent.com/22350/98923649-38d3bf80-24d4-11eb-955a-5c9560dfbf76.png

That means opening the settings: Ctrl+,, that will update the VSCode settings.json.

Sign up to request clarification or add additional context in comments.

5 Comments

They deleted this functionality as of today (March 2023)? I do not find any option to add the --no-verify tag!!
@joangm_ I do see that option, but only if I activate the setting git.allowNoVerifyCommit.
Oh, yes! It worked! Thank you very much! For people wondering, you have to add that line in settings.json of the VSCode.
@joangm_ True. I have edited the answer to include the shortcut to open VSCode settings.
after changing the setting, you also need to restart extension host (or reload vscode)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.