GithubHelp home page GithubHelp logo

jacksgong / cz-cli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from commitizen/cz-cli

0.0 3.0 0.0 210 KB

The commitizen command line utility.

Home Page: http://commitizen.github.io/cz-cli/

License: MIT License

JavaScript 99.28% Batchfile 0.06% Shell 0.66%

cz-cli's Introduction

Commitizen for contributors

When you commit with Commitizen, you'll be prompted to fill out any required commit fields at commit time. No more waiting until later for a git commit hook to run and reject your commit (though that can still be helpful). No more digging through CONTRIBUTING.md to find what the preferred format is. Get instant feedback on your commit message formatting and be prompted for required fields.

travis.ci Build status codecov.io npm monthly downloads current version bitHound Score semantic-release

Installing the command line tool

Installation is as simple as running the following command (add sudo if on OSX/Linux):

npm install -g commitizen

Using the command line tool

Now, simply use git cz instead of git commit when committing.

When you're working in a Commitizen friendly repository, you'll be prompted to fill in any required fields and your commit messages will be formatted according to the the standards defined by project maintainers.

Add and commit with Commitizen

If you're not working in a Commitizen friendly repository, then git cz will work just the same as git commit.

Commitizen for project maintainers

As a project maintainer, making your repo Commitizen friendly allows you to select pre-existing commit message conventions or to create your own custom commit message convention. When a contributor to your repo uses Commitizen, they will be prompted for the correct fields at commit time.

Making your repo Commitizen-friendly

For this example, we'll be setting up our repo to use AngularJS's commit message convention also known as conventional-changelog.

First, install the Commitizen cli tools:

npm install commitizen -g

Next, initialize your project to use the cz-conventional-changelog adapter by typing:

commitizen init cz-conventional-changelog --save --save-exact

Note that if you want to force install over the top of an old adapter, you can apply the --force argument. For more information on this, just run commitizen help.

The above command does three things for you. It installs the cz-conventional-changelog adapter npm module, it saves it to the package.json's dependencies or devDependencies, and lastly it add the config.commitizen key to the root of your package.json as shown here:

...
  "config": {
    "commitizen": {
      "path": "node_modules/cz-conventional-changelog"
    }
  }

This just tells Commitizen which adapter we actually want our contributors to use when they try to commit to this repo.

Please note that in previous version of Commitizen we used czConfig. czConfig has been deprecated and you should migrate to the new format before Commitizen 3.0.0.

Congratulations your repo is Commitizen-friendly. Time to flaunt it!

Add the Commitizen-friendly badge to your README using the following markdown:

[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

Your badge will look like this:

Commitizen-friendly

It may also make sense to change your README.md or CONTRIBUTING.md to include or link to the Commitizen project so that your new contributors may learn more about installing and using Commitizen.

Go further

Commitizen is great on its own, but it shines when you use it with some other amazing open source tools. Kent C. Dodds shows you how to accomplish this in his Egghead.io series, How to write an open source javascript library. Many of the concepts can be applied to non-javascript projects as well.

Adapters

We know that every project and build process has different requirements so we've tried to keep Commitizen open for extension. You can do this by choosing from any of the pre-build adapters or even by building your own. Here are some of the great adapters available to you:

To create an adapter, just fork one of these great adapters and modify it to suit your needs. We pass you an instance of Inquirer.js but you can capture input using whatever means neccesary. Just call the commit callback with a string and we'll be happy. Publish it to npm, and you'll be all set!

Philosophy

About Commitizen

Commitizen is an open source project that helps contributors be good open source citizens. It accomplishes this by prompting them to follow commit message conventions at commit time. It also empowers project maintainers to create or use predefined commit message conventions in their repos to better communicate their expectations to potential contributors.

Commitizen or Commit Hooks

Both! Commitizen is not meant to be a replacement for git commit hooks. Rather, it is meant to work side-by-side with them to ensure a consistent and positive experience for your contributors. Commitizen treats the commit command as a declarative action. The contributor is declaring that they wish to contribute to your project. It is up to you as the maintainer to define what rules they should be following.

We accomplish this by letting you define which adapter you'd like to use in your project. Adapters just allow multiple projects to share the same commit message conventions. A good example of an adapter is the cz-conventional-changlog adapter.

Authors and Contributors

@JimTheDev (Jim Cummins, author) @kentcdodds @accraze @kytwb @Den-dp

Special thanks to @stevelacy, whose gulp-git project makes commitizen possible.

cz-cli's People

Contributors

accraze avatar bitdeli-chef avatar d4rkr00t avatar greenkeeperio-bot avatar jimthedev avatar

Watchers

 avatar  avatar  avatar

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.