Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commitizen: Is there a way to override standard `git commit`?

Tags:

git

commitizen

Any commitizen users here?

Wanted behavior:

  1. install commitizen
  2. run git commit
  3. see the same nice menu as when running git cz

Current behavior:

  1. install commitizen
  2. run git commit
  3. NO nice menu as when running git cz, just default git interface
like image 761
Nurbol Alpysbayev Avatar asked Oct 28 '22 06:10

Nurbol Alpysbayev


People also ask

What does commitizen do?

Commitizen is a tool designed for teams. Its main purpose is to define a standard way of committing rules and communicating it (using the cli provided by commitizen). The reasoning behind it is that it is easier to read, and enforces writing descriptive commits.

Can I git commit without add?

Without adding any files, the command git commit won't work. Git only looks to the staging area to find out what to commit. Staging, or adding, files, is possible through the command line, and also possible with most Git interfaces like GitHub Desktop by selecting the lines or files that you'd like to stage.

What is the commit command for all changes with a message?

To add a Git commit message to your commit, you will use the git commit command followed by the -m flag and then your message in quotes. Adding a Git commit message should look something like this: git commit -m “Add an anchor for the trial end sectionnn.”

What is git cz?

git-cz is short for git-commitizen. A Conventional commit cli. git-cz gives tools to work with Conventional Commits. The tool is still in early development.


1 Answers

yes you can do it with the git hooks. Just do the following as it is written on the https://commitizen.github.io/cz-cli/ site.

Add in the file .git/hooks/prepare-commit-msg (if the file is not present just create it) in your root folder of the project following lines:

#!/bin/bash exec < /dev/tty && node_modules/.bin/git-cz --hook || true

If the file is already there just add the exec line and git commit will now show the same menu as when git cz.

like image 107
Thikron Avatar answered Dec 03 '22 23:12

Thikron