commitizen / cz-cli

The commitizen command line utility. #BlackLivesMatter
http://commitizen.github.io/cz-cli/
MIT License
16.7k stars 547 forks source link

For me, I'm trying to use the single command `git commit` and it prompt to choose my type: #841

Closed k2on closed 3 years ago

k2on commented 3 years ago

For me, I'm trying to use the single command git commit and it prompt to choose my type:

husky > pre-commit (node v12.17.0)
ℹ No staged files match any configured task.
husky > prepare-commit-msg (node v12.17.0)
? Select the type of change that you're committing: (Use arrow keys or type to search)
❯ test:       Adding missing tests 
  feat:       A new feature 
  fix:        A bug fix 
  chore:      Build process or auxiliary tool changes 
  docs:       Documentation only changes 
  refactor:   A code change that neither fixes a bug or adds a feature 
  style:      Markup, white-space, formatting, missing semi-colons... 

Then I make de description:

...
? Select the type of change that you're committing: chore:      Build process or auxiliary tool changes
? Write a short, imperative mood description of the change: 
  [-------------------------------------------------------------] 34 chars left
   chore: husky hook on git-cz

But it's falling back to VIM to edit COMMIT_EDITMSG:

chore: husky hook on git-cz
~                                                                                                                                           
~                                                                                                                                           
~                                                                                                                                           
~                                                                                                                                           
~                                                                                                                                           
~                                                                                                                                           
~                                                                                                                                           
~                                                                                                                                           
~                                                                                                                                           
~                                                                                                                                           
~                                                                                                                                           
"~/repo/.git/COMMIT_EDITMSG" [noeol] 1L, 27C

My pakcage.json husky config and version:

...
"dependencies": {
    "@commitlint/cli": "^11.0.0",
    "@commitlint/config-conventional": "^11.0.0",
    "@commitlint/config-lerna-scopes": "^11.0.0",
    "commitizen": "^4.2.3",
    "cz-conventional-changelog": "^3.3.0",
    "eslint": ">=6.0.0",
    "git-cz": "^4.7.6",
    "husky": "^4.3.8",
    "lerna": "^3.22.1",
    "lint-staged": "^10.5.3",
    "prettier": "^2.2.1",
    "stylelint": "^13.9.0"
  },
"husky": {
    "hooks": {
      "pre-commit": "lint-staged",
      "prepare-commit-msg": "exec < /dev/tty && git cz --hook || true",
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  },

-> Some can help me with this issue? There is some "thing" to avoid open the COMMIT_EDITMSG or is the default behavior?

Originally posted by @jaikme in https://github.com/commitizen/cz-cli/issues/688#issuecomment-767131493

k2on commented 3 years ago

Duplicate issues everywhere haha