|
| 1 | +The `cz init` command helps you set up Commitizen in your project by creating a configuration file with your preferred settings. |
| 2 | + |
1 | 3 | ## Usage
|
2 | 4 |
|
3 | 5 | 
|
4 | 6 |
|
5 |
| -## Example |
6 |
| - |
7 |
| -To start using Commitizen, the recommended approach is to run |
| 7 | +## Command |
8 | 8 |
|
9 | 9 | ```sh
|
10 | 10 | cz init
|
11 | 11 | ```
|
12 | 12 |
|
| 13 | +## Interactive Configuration |
| 14 | + |
| 15 | +When you run `cz init`, Commitizen will guide you through an interactive setup process: |
| 16 | + |
13 | 17 | 
|
14 | 18 |
|
15 |
| -This command will ask you for information about the project and will |
16 |
| -configure the selected file type (`pyproject.toml`, `.cz.toml`, etc.). |
| 19 | +## Configuration File |
| 20 | + |
| 21 | +The initialization process will create a configuration file in your project root. |
| 22 | + |
| 23 | +Choose the configuration file format based on your project type: |
| 24 | + |
| 25 | +- Use `pyproject.toml` for Python projects |
| 26 | +- Use `.cz.toml`, `.cz.yaml`, `.cz.json`, etc. for other projects. |
| 27 | + |
| 28 | +## Configuration Options |
| 29 | + |
| 30 | +During the initialization process, you'll be prompted to configure the following settings: |
| 31 | + |
| 32 | +1. **Convention Rules**: Select the commit message convention to follow (e.g., conventional commits) |
| 33 | +2. **Version Provider**: Choose how to manage versioning in your project. Commitizen supports multiple version management systems: |
| 34 | + - `commitizen`: Uses Commitizen's built-in version management system |
| 35 | + - `npm`: Manages version in `package.json` for Node.js projects |
| 36 | + - `cargo`: Manages version in `Cargo.toml` for Rust projects |
| 37 | + - `composer`: Manages version in `composer.json` for PHP projects |
| 38 | + - `pep621`: Uses `pyproject.toml` with PEP 621 standard |
| 39 | + - `poetry`: Uses `pyproject.toml` with Poetry configuration |
| 40 | + - `uv`: Uses `pyproject.toml` and `uv.lock` for Python projects |
| 41 | + - `scm`: Reads version directly from git tags without modifying files |
| 42 | +3. **Project Version**: The current version of your project will be detected automatically |
| 43 | +4. **Tag Format**: The format used for version tags in your repository |
| 44 | +5. **Version Type**: Choose between: |
| 45 | + - `semver` or `semver2`: Semantic Versioning (MAJOR.MINOR.PATCH) |
| 46 | + - `pep440`: Python Package Versioning |
| 47 | +6. **Changelog Generation**: Configure whether to automatically generate changelog during version bumps |
| 48 | +7. **Alpha Versioning**: Option to keep major version at 0 for alpha/beta software |
| 49 | +8. **Pre-commit Hooks**: Set up Git pre-commit hooks for automated commit message validation |
| 50 | + |
| 51 | +## Example |
| 52 | + |
| 53 | +```sh |
| 54 | +# Start the initialization process |
| 55 | +cz init |
| 56 | + |
| 57 | +# Follow the interactive prompts to configure your project |
| 58 | +``` |
| 59 | + |
| 60 | +## Next Steps |
17 | 61 |
|
18 |
| -The `init` will help you with |
| 62 | +After initialization, you can: |
19 | 63 |
|
20 |
| -1. Choose a convention rules (`name`) |
21 |
| -2. Choosing a version provider (`commitizen` or for example `Cargo.toml`) |
22 |
| -3. Detecting your project's version |
23 |
| -4. Detecting the tag format used |
24 |
| -5. Choosing a version type (`semver` or `pep440`) |
25 |
| -6. Whether to create the changelog automatically or not during bump |
26 |
| -7. Whether you want to keep the major as zero while building alpha software. |
27 |
| -8. Whether to setup pre-commit hooks. |
| 64 | +1. Start using `cz commit` to create conventional commits |
| 65 | +2. Use `cz bump` to manage versioning |
| 66 | +3. Configure additional settings in your project's configuration file |
0 commit comments