22

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
    – Liam
    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'
    – Liam
    Oct 25, 2018 at 10:20
  • @Liam thanks for your reply. How can I make that alias my default commit command in VS Code? Oct 27, 2018 at 14:21
  • You cant. Why does it make a difference? git commit vs git mycommit?
    – Liam
    Oct 29, 2018 at 9:13
  • 2
    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! Oct 29, 2018 at 16:52

1 Answer 1

18

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 enablegit.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.

4
  • 1
    They deleted this functionality as of today (March 2023)? I do not find any option to add the --no-verify tag!!
    – joangm_
    Mar 22 at 12:27
  • 3
    @joangm_ I do see that option, but only if I activate the setting git.allowNoVerifyCommit.
    – VonC
    Mar 22 at 15:45
  • Oh, yes! It worked! Thank you very much! For people wondering, you have to add that line in settings.json of the VSCode.
    – joangm_
    Mar 29 at 8:33
  • 2
    @joangm_ True. I have edited the answer to include the shortcut to open VSCode settings.
    – VonC
    Mar 29 at 8:37

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.