Code Monkey home page Code Monkey logo

git-cz's Introduction

Commitizen friendly

git-cz

image

Without installation

npx git-cz
# or
npx git-cz -e

Install globally standalone

npm install -g git-cz
git-cz
# or
git-cz -e

Install locally with Commitizen

npm install -g commitizen
npm install --save-dev git-cz

package.json:

{
  "config": {
    "commitizen": {
      "path": "git-cz"
    }
  }
}

run:

git cz

Install globally with Commitizen

npm install -g commitizen git-cz
commitizen init git-cz --save-dev --save-exact

run:

git cz

Custom config

You can provide a custom configuration in a changelog.config.js file in your repo, or in any parent folder. git-cz will search for the closest config file. Below is default config:

module.exports = {
  disableEmoji: false,
  format: '{type}{scope}: {emoji}{subject}',
  list: ['test', 'feat', 'fix', 'chore', 'docs', 'refactor', 'style', 'ci', 'perf'],
  maxMessageLength: 64,
  minMessageLength: 3,
  questions: ['type', 'scope', 'subject', 'body', 'breaking', 'issues', 'lerna'],
  scopes: [],
  types: {
    chore: {
      description: 'Build process or auxiliary tool changes',
      emoji: 'πŸ€–',
      value: 'chore'
    },
    ci: {
      description: 'CI related changes',
      emoji: '🎑',
      value: 'ci'
    },
    docs: {
      description: 'Documentation only changes',
      emoji: '✏️',
      value: 'docs'
    },
    feat: {
      description: 'A new feature',
      emoji: '🎸',
      value: 'feat'
    },
    fix: {
      description: 'A bug fix',
      emoji: 'πŸ›',
      value: 'fix'
    },
    perf: {
      description: 'A code change that improves performance',
      emoji: '⚑️',
      value: 'perf'
    },
    refactor: {
      description: 'A code change that neither fixes a bug or adds a feature',
      emoji: 'πŸ’‘',
      value: 'refactor'
    },
    release: {
      description: 'Create a release commit',
      emoji: '🏹',
      value: 'release'
    },
    style: {
      description: 'Markup, white-space, formatting, missing semi-colons...',
      emoji: 'πŸ’„',
      value: 'style'
    },
    test: {
      description: 'Adding missing tests',
      emoji: 'πŸ’',
      value: 'test'
    },
    messages: {
      type: 'Select the type of change that you\'re committing:',
      customScope: 'Select the scope this component affects:',
      subject: 'Write a short, imperative mood description of the change:\n',
      body: 'Provide a longer description of the change:\n ',
      breaking: 'List any breaking changes:\n',
      footer: 'Issues this commit closes, e.g #123:',
      confirmCommit: 'The packages that this commit has affected\n',
    },
  }
};

Non-interactive mode

Using --non-interactive flag you can run git-cz non-interactive mode.

For example:

git-cz --non-interactive --type=feat --subject="add onClick prop to component"

CLI parameters:

  • --type
  • --subject
  • --scope
  • --body
  • --breaking
  • --issues
  • --lerna

Disable Emoji

Using --disable-emoji flag will disable emoji.

For example:

git-cz --disable-emoji

Commit message format

  • A commit message consists of a header, body and footer.
  • The header has a type and a subject:
<type>[(<scope>)]: <emoji> <subject>
[BLANK LINE]
[body]
[BLANK LINE]
[breaking changes]
[BLANK LINE]
[footer]

The header is the only mandatory part of the commit message.

The first line (type + subject) is limited to 50 characters [enforced]

Any other line should be limited to 72 character [automatic wrapping]

This allows the message to be easier to read on GitHub as well as in various git tools.

Format

By default the subject format is: {type}{scope}: {subject}

Configuring the format field in .git-cz.json you can customize your own:

  • {type}{scope}: {emoji}{subject}
  • {emoji}{scope} {subject}

Type

Must be one of the following:

  • 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...
  • ci β€” CI related changes
  • perf β€” A code change that improves performance

Subject

The subject contains succinct description of the change:

  • Use the imperative, present tense: "change" not "changed" nor "changes"
  • No dot (.) at the end.

Body

Just as in the subject, use the imperative, present tense: "change" not "changed" nor "changes". The body should include the motivation for the change and contrast this with previous behavior.

Affects [only on lerna environments]

Select the packages the commit affected.

Breaking Changes

Breaking Changes must start with the words BREAKING CHANGE: .

Footer

The footer is the place to reference any tasks related to this commit.

Why this Fork?

npm i -g git-cz
added 1 package in 0.612s

Installs in 0.6s vs 31.1s.

npm i -g mol-conventional-changelog
added 345 packages in 31.076s

git-cz's People

Contributors

alexathome avatar allen-1998 avatar bogusweb avatar brokenmass avatar carlosvillademor avatar carpasse avatar damusix avatar dependabot[bot] avatar ikhemissi avatar jeroenknoops avatar jeromefitz avatar jlarmstrongiv avatar kamack38 avatar khaledosman avatar kyle7zhang avatar patsuitestudios avatar renovate-bot avatar renovate[bot] avatar rodrigograca31 avatar semantic-release-bot avatar snaerth avatar stanlindsey avatar streamich avatar theashraf avatar umutcanbolat avatar warapitiya avatar xram avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git-cz's Issues

--help flag

Add --help and -h flags that print usage instructions.

'description' field not updating and submitting with commits

I have tried description field many times, and it's broken for quite a few time.
Below is the image where I entered description
image

And now, below image on github, where no description is sent with commit
image

Current version at my end of git cz - 4.5.0

git-cz does not adhere to directory configuration of lerna.

In lerna you can set the directory of the packages by setting them in lerna.json:

...
  "packages": [
    "workspaces/*"
  ],
...

and in package.json

...
  "workspaces": {
    "packages": [
      "workspaces/*"
    ] 
  },
...

Unfortunately git-cz is not respecting these settings.

Workaround:

ln -s workspaces packages

git cz -a not working?

In the past version, I can pass some git commit args to git cz, E.g: git cz -a.

But I found it's not working since the latest version. Did you remove this feature?

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The push permission to the Git repository is required.

semantic-release cannot push the version tag to the branch master on remote Git repository with URL git+ssh://[email protected]/streamich/git-cz.git.

Please refer to the authentication configuration documentation to configure the Git credentials on your CI environment and make sure the repositoryUrl is configured with a valid Git URL.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

git-cz / commitizen confusion.

Hi there @streamich!

Looks cool what you are building. I have been having people open issues like commitizen/cz-cli#595 asking why they are sometimes seeing your package and other times commitizen. As I said this is my fault for using git-cz as the package name. Still people are getting confused so I was wondering if you would ever consider taking git-c and then giving over git-cz to commitizen as a package. If not I understand but just wanted to check to stop the confusion.

Anyhow have a good day.

Why pin devDependencies?

@streamich

I was looking at the project and noticed that all devDependencies are pinned.

"devDependencies": {
    "@semantic-release/changelog": "3.0.6",
    "@semantic-release/git": "8.0.0",
    "any-shell-escape": "0.1.1",
    "browserify": "16.5.2",
    "chai": "4.2.0",
    "chalk": "2.4.2",
    "commitizen": "2.10.1",
    "eslint": "^4.19.1",
    "eslint-config-mailonline": "9.0.1",
    "fuzzy": "0.1.3",
    "global": "4.4.0",
    "husky": "4.2.5",
    "inquirer": "6.5.2",
    "inquirer-list-search-prompt": "1.0.2",
    "jest": "25.5.4",
    "minimist": "1.2.5",
    "mocha": "6.2.3",
    "pkg": "4.4.8",
    "rimraf": "3.0.2",
    "semantic-release": "16.0.4",
    "signale": "1.4.0",
    "spawncommand": "2.2.0",
    "word-wrap": "1.2.3"
  },

Then tracked it down to @renovate-bot, more precisely to:

"devDependencies": {
    "automerge": true,
    "pinVersions": true
  }

in renovate.json

I do understand that you might want to have the same "base" for everyone while developing instead of allowing differences due to patches and new features released in a given dev dependency...

My question for you @streamich is:
Do you think this should be the default behavior? Or should we change it by adding ^ for all the devDependencies ? πŸ€”
Allowing for patches and new features.

Example: "eslint": "^7.7.0",.

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Opt-out emojis

As addressed here #8, we can disable emojis in commits by not sending them configuring the changelog.config.js file.

Now my question is: how can we opt-out them completely? I configured the file but whenever there is a breaking change or an issue closing commit, the emojis 🧨 and βœ…are being sent. I see no option except to fork and remove them myself.

Where did (scope) go?

Why doesnt git cz ask for the scope?

image

Looking at this repo it self theres almost no (scope)

--version flag

Add --version and -v that prints version of this package, taken from package.json.

Global config

Allow user to set global config. git-cz would look for global config if it cannot find a local one.

Global config could be placed in ~/.git-cz.json file.

Skip CI option

Is there a way to include a "Skip CI?" question? I keep on forgetting to add it on my own. Or there is a way for me to include it on my project?

Semantic branch names

Add interactive command for creating semantic branch names.

image

Format would be:

<emoji>-<type>/<date>/<name>
  • type is one of

Example:

πŸ”₯-hotfix/2020-07-17/broken-db-connection

Command could be:

git-cz b
git-cz branch
  • type and emoji should be customizable.
  • default types are
    • feat
    • fix
    • hotfix
    • release
  • date should be in YYYY-MM-DD format.
  • date could be disabled in config

Malware warning

Hello :)

When I was scanning my mac with AVG I got following malware warning for git-cz node module. I am not sure if this is true or false but worried since I have used this package in number of different projects. Could anyone help me out what to do.

This is the screenshot
https://imgur.com/a/2FmbZwY

Unable to use npx git-cz | git-cz

This issue is with global version installed of git-cz.
version installed - 4.6.0
npx git-cz && git-cz giving same error of

'!' is not recognized as an internal or external command, operable program or batch file. Γ— fatal Error: No files staged.

I am running command in right folder, and it has files staged as well, which I double check and get

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
  ${complete_file_path}

Disable emoji in config

I love you package and my team wants to use it. But some are not happy with the emoji. Could you provide an option in the changelog.config.js that maybe disables emojis instead of showing a question mark

disable emoji on CLI

Add option on CLI to disable emoji, like:
git-cz --disable-emoji

Many times I only want commit without emoji, and to do that I need to create the file changelog.config.js.

Unable to use npx git-cz

It's really confusing about which of the repos actually owns npx git-cz, but here's a link to the already open issue: commitizen/cz-cli#701

I'm unable to commit anything with npx git-cz right now.

@streamich This is a major breaking issue! Please help

Git co-author

For companies that do a fair amount of paired programming, it's valuable to be able to represent multiple authors for commits. So we use Git's co-author feature:
https://help.github.com/en/articles/creating-a-commit-with-multiple-authors#creating-co-authored-commits-on-the-command-line

It would be great if this was a feature with these capabilities:

  • Have a step in the CLI that asks for a co-author (after everything else?)
  • In git-cz config add flag to disable/enable co-author CLI step.
  • Provide list of easy to add co-authors via global config (workstation) and/or project config.
    • Ability to add multiple co-authors.
  • Automatically add the bash profile in context as one of the authors (if additional co-authors are selected).
  • Automatically add co-authors via global config (workstation) and/or project config.
  • Co-author tag for custom commit message template.

Docs cleanup

  • Move most of the contents of README.md into separate files:
    • /docs/Installation.md
    • /docs/Configuration.md
    • add /docs/CLI-options.md
    • /docs/Semantic-commits.md
  • Keep in README.md
    • Screenshot
    • Add more badges
    • Quick-start comand npx git-cz
    • Links to docs in /docs folder

Bug: Committing in OSX breaks since 1.8.1

npx git-cz breaks with

βœ–  fatal     TypeError: changedFiles is not iterable 
    at getChangedPackages (/Users/avi/.npm/_npx/22780/lib/node_modules/git-cz/dist/cli.js:657:26)
    at Object.exports.createQuestion (/Users/avi/.npm/_npx/22780/lib/node_modules/git-cz/dist/cli.js:470:27)```

Release 1.8.1 just broke commiting

When running npx git-cz it is failing right now with:

fatal Error: Could not find Git root folder.

Since 15min which is the release time :(

Edit: I'm on Mac

Test coverage

git-cz is a fork of a project that did not have unit tests and it is fortunate to be real-life tested by hundreds of developers every day, however, this should change. We should add unit tests to cover all most important parts of git-cz.

3.3.0 does not contain latest disableEmoji fix

Hello there!

I found a bug with disableEmoji, but it turns out the fix is already in master and is tagged with the 3.3.0 release: 62915be

However... I have installed 3.3.0 and in my node_modules/git-cz/dist/cz.js I find this: const closedIssueEmoji = config.disableEmoji ? config.closedIssuePrefix : '';.

So it turns out that this fix has not actually been released yet. Don't know where that went wrong, but it does mean that I still experience the bug πŸ˜…

Single Quotes break functionality on windows

The default behavior of this plugin does not work on my windows machine because the commit message must be formed with double quotes, not single.

Reproduction:

C:\projects\some-testing>git-cz dry-run
Running in dry mode.
? Select the type of change that you're committing: 🎸  feat:       A new feature
? Write a short, imperative mood description of the change:
  [-------------------------------------------------------------] 55 chars left
   feat: testing feat
? Provide a longer description of the change:
 
? List any breaking changes
  BREAKING CHANGE:
? Issues this commit closes, e.g #123:
Will execute command:
git commit --message 'feat: 🎸 testing feat'

C:\projects\some-testing>git commit --message 'feat: 🎸 testing feat'
error: pathspec '🎸' did not match any file(s) known to git
error: pathspec 'testing' did not match any file(s) known to git
error: pathspec 'feat'' did not match any file(s) known to git

C:\projects\some-testing>git commit --message "feat: 🎸 testing feat"
[master cce34e3] feat: 🎸 testing feat
 3 files changed, 22 insertions(+), 11 deletions(-)

Running non-dry just gives the expected error: pathspec [...].

Is it possible to make an option so that double quotes are used? Thank you.

Can't find local pkgs when run from global

Using "Install locally with Commitizen"

npm i -g commitizen
npm i -D git-cz
npm i -D commitiquette
  "config": {
    "commitizen": {
      "path": "commitiquette"
    }
  },

When running

> git cz
Could not resolve commitiquette. Cannot find module 'commitiquette'

> git-cz
Could not resolve commitiquette. Cannot find module 'commitiquette'

This works

  "scripts": {
    "commit": "git-cz"
  },

> npm run commit

The β€œdisableEmoji”: true option in the configuration file is invalidated

This will invalidate the β€œdisableEmoji” option in the configuration file

  • git-cz/lib/createState.js
    The sequence of 24 lines and 25 lines of code caused the configuration of the configuration file to be overwritten
  • git-cz/lib/parseArgs.js
    53 lines of code cause the "disable-emoji" option to default to false

Translated by Google Translate

Are we dependent on a dead project?

Hi @streamich

I'm not that familiar with ESLint and much less with the configurations, but this project is dependent on a project that is causing issues and it might never be updated/fixed: eslint-config-mailonline

According to GitHub, we are their main dependant: https://github.com/MailOnline/eslint-config-mailonline/network/dependents

This project is holding quite a few dependencies from being updated:
https://github.com/MailOnline/eslint-config-mailonline/network/dependencies

Namely: eslint, babel-eslint, semantic-release, etc which causes our build to break when trying to update eslint: #171

I've open an issue there but something tells me no one will fix it because even though a commit was recently added the project hasn't been modified since 2017

With all this said, what can we do? Do we need that dependency? Can we substitute it with a better/updated one? What would the alternatives be? πŸ€”

Like I said I don't know enough about ESLint to know what can be done here...
I'm just trying to help and move this project forward by keeping everything well oiled and moving πŸ˜„

Regards

Non-interactive CLI

Add ability to create git-cz-like commits in non-interactive mode where all parameters are provided through CLI arguments and no UI is displayed. For example:

git-cz --non-interactive --message="First commit" --type=feat

All arguments could be optional, but could also be overwritten through CLI arguments:

  • --message
  • --type
  • --scope
  • --description
  • etc.

Global config file?

Hi

I'd like to be able to make the config file global to all my projects instead of the current one as I expressed here: #161 (comment)

Because I'm following this "standard" https://gitmoji.carloscuesta.me/ and some of the emojis are not the same, for example ✨ is for features and I agree more with that standard than with the 🎸, same goes for other emojis you guys chose.

and I dont want to have to create a config file for each of my projects....

Thanks

Empty scope config break husky's commitlint commit-msg hook

Note: I just gave a quick look at the source so I might make wrong assumptions.

It seems that, by default, git-cz does not give the option to enter the commit's scope.

I don't know if it's intentional. I could understand it so that it must be configured before, allowing to have a finite set of scopes in which the user can choose (and avoid the infinite growing scope list problem).

However I am facing a use case where this is blocking (sort of) something I am trying to do.

I am creating a project template that can be used to bootstrap projects quickly in our company with some sort of sane defaults.

I included the cz-conventional-changelog adapter as well as husky and commitlint with the config-conventinal config for commitlint. If i try to commit something, husky does not validate any commit as the scope is empty (the question is not asked).

Do you think that would make sense to configure it, so that the question can be asked and the user create a new scope if the list is empty ? That would make sense for that use case even though i would understand that thinking about scopes beforehand would be wiser.

Also, is there an option to disable emoji ? (I will look deeper in the codebase for this one)

Husky integration

Firstly, thanks for the excellent project!
I would like to use git-cz as husky prepare-commit-msg hook. I still couldn’t get it to work correctly with commitizen (looped message generation or this issue). Looking at your source code, I found that cli.js script starts the commit mechanism after message generation.

const message = formatCommitMessage(state);

I think it's possible to check availability process.env.HUSKY_GIT_PARAMS and if exists then write message into .git/COMMIT_EDITMSG instead of run commit.

...
const message = formatCommitMessage(state);

if (process.env.HUSKY_GIT_PARAMS) {
// process.env.HUSKY_GIT_PARAMS = something like '.git/COMMIT_EDITMSG message'
  const arrHuskyGitParams = process.env.HUSKY_GIT_PARAMS.split(' ');
  fs.writeFileSync(arrHuskyGitParams[0], message);
  process.exit(0);
}
... // continue commiting

After this changes we also can use git-cz as husky hook without commitizen. Something like this (package.json):

{
...
  "husky": {
    "hooks": {
      "prepare-commit-msg": "exec < /dev/tty && git-cz || true"
    }
  }
...
}

P.S. Sorry for my english

[Feature] add i18n support.

May be I will do this when I have time.

  1. Use os-locale get user locale.
  2. Read package.json 's value: config.git-cz.i18n , which is object. try get custom locale file path.
  3. If no custom locale file, try get default locale file path.
  4. If still no found the locale file. use en locale file as alertnative.

Any other idea?

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Binary distributable

Create a binary distributable of this package that does not require Node to be installed to run.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.