### Installing git-mit with Homebrew (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/README.md Provides the command to install the `git-mit` suite of tools using the Homebrew package manager. This is the recommended installation method and includes shell completions. Requires Homebrew to be installed. ```shell brew install PurpleBooth/repo/git-mit ``` -------------------------------- ### Installing git-mit Binaries with Cargo (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/README.md Provides commands to install the individual `git-mit` binaries using the Cargo package manager. This method installs the tools but does not include shell completions automatically. Requires Rust and Cargo to be installed. ```shell cargo install git-mit cargo install git-mit-config cargo install git-mit-install cargo install git-mit-relates-to cargo install mit-commit-msg cargo install mit-pre-commit cargo install mit-prepare-commit-msg ``` -------------------------------- ### Generate Example TOML Configuration (shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md Runs the git-mit-config command to generate and display an example TOML configuration for authors. Useful for seeing the expected format. ```shell git-mit-config mit example ``` -------------------------------- ### Initialize Git Repository and Install git-mit Hooks (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/README.md Initializes a new git repository in the current directory and installs the git-mit hooks into the repository's hooks directory. ```shell git init . git mit-install ``` -------------------------------- ### Create Example Markdown File Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit-relates-to.md Creates a simple Markdown file named `README.md` to serve as content for a commit. This file is used in subsequent examples. ```markdown # The Best Readme This is the best readme ``` -------------------------------- ### Example Script to Fetch Pivotal Tracker ID Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit-relates-to.md A shell script example using `curl` and `jq` to fetch the current started story ID for the current user from Pivotal Tracker. Requires `PIVOTAL_TRACKER_TOKEN` and `.pivotal_tracker_project` file. ```shell echo "[#$(curl --silent -X GET -H "X-TrackerToken: $PIVOTAL_TRACKER_TOKEN" "https://www.pivotaltracker.com/services/v5/projects/$(cat .pivotal_tracker_project)/stories?filter=state:started+owner:$(curl --silent "https://www.pivotaltracker.com/services/v5/me?fields=%3Adefault" -H "X-TrackerToken: $PIVOTAL_TRACKER_TOKEN" | jq -r .initials)" | jq .[0].id)]" ``` -------------------------------- ### Generating Example git-mit Configuration (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/README.md Uses the `git-mit-config` command to generate an example configuration file for `git-mit`. This provides a template for users to customize their author initials and details. Requires the `git-mit-config` binary. ```shell git-mit-config mit example ``` -------------------------------- ### Initialize Git Repository and Install Hooks (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/lints/index.md Initializes a new Git repository in the current directory and installs the git-mit commit hooks required for linting commit messages. ```shell git init . git mit-install ``` -------------------------------- ### Example .git-mit.toml.dist Configuration (TOML) Source: https://github.com/purplebooth/git-mit/blob/main/README.md Provides an example TOML configuration file (`.git-mit.toml.dist`) to centralize lint settings for a repository, enabling the `pivotal-tracker-id-missing` lint. ```toml [mit.lint] "pivotal-tracker-id-missing" = true ``` -------------------------------- ### Example YAML Author Configuration Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md An example configuration file in YAML format defining multiple authors. This format provides an alternative to TOML for persisting author settings. ```yaml --- ae: name: Anyone Else email: anyone@example.com bt: name: Billie Thompson email: billie@example.com signingkey: 0A46826A se: name: Someone Else email: someone@example.com ``` -------------------------------- ### Example TOML Author Configuration Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md An example configuration file in TOML format defining multiple authors with their names, emails, and optional signing keys. This format can be used to persist author settings. ```toml [ae] name = "Anyone Else" email = "anyone@example.com" [bt] name = "Billie Thompson" email = "billie@example.com" signingkey = "0A46826A" [se] name = "Someone Else" email = "someone@example.com" ``` -------------------------------- ### Example Output: Available git-mit Lints Source: https://github.com/purplebooth/git-mit/blob/main/README.md Shows the expected output format when listing available git-mit lints, including the lint name and its status. ```text ╭───────────────────────────────────┬──────────╮ │ Lint ┆ Status │ ╞═══════════════════════════════════╪══════════╡ │ duplicated-trailers ┆ enabled │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤ │ pivotal-tracker-id-missing ┆ disabled │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤ │ jira-issue-key-missing ┆ disabled │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤ │ github-id-missing ┆ disabled │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤ │ subject-not-separated-from-body ┆ enabled │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤ │ subject-longer-than-72-characters ┆ enabled │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤ │ subject-line-not-capitalized ┆ disabled │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤ │ subject-line-ends-with-period ┆ disabled │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤ │ body-wider-than-72-characters ┆ enabled │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤ │ not-conventional-commit ┆ disabled │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤ │ not-emoji-log ┆ disabled │ ╰───────────────────────────────────┴──────────╯ ``` -------------------------------- ### git-mit Help Output Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/git-mit.md Displays the detailed help message for the `git-mit` command, outlining usage, arguments, options, and examples of common tasks. ```shell Set author and Co-authored trailer. Usage: git-mit [OPTIONS] [INITIALS]... Arguments: [INITIALS]... Initials of the mit to put in the commit Options: -c, --config Path to a file where mit initials, emails and names can be found [env: GIT_MIT_AUTHORS_CONFIG=] [default: $HOME/.config/git-mit/mit.toml] -e, --exec Execute a command to generate the mit configuration, stdout will be captured and used instead of the file, if both this and the file is present, this takes precedence [env: GIT_MIT_AUTHORS_EXEC=] -t, --timeout Number of minutes to expire the configuration in [env: GIT_MIT_AUTHORS_TIMEOUT=] [default: 60] --completion Shell to generate completions for [possible values: bash, elvish, fish, powershell, zsh] -h, --help Print help -V, --version Print version COMMON TASKS: You can install git-mit into a new repository using git mit-install You can add a new author to that repository by running git mit-config mit set eg "Egg Sample" egg.sample@example.com You can save that author permanently by running git mit-config mit set eg "Egg Sample" egg.sample@example.com git mit-config mit generate > $HOME/.config/git-mit/mit.toml You can disable a lint by running git mit-config lint disable jira-issue-key-missing You can install the example authors file to the default location with git mit-config mit example > $HOME/.config/git-mit/mit.toml You can set the current author, and Co-authors by running git mit ae se You can populate the `Relates-to` trailer using git mit-relates-to "[#12345678]" ``` -------------------------------- ### Good Commit Example: Documentation Update Source: https://github.com/purplebooth/git-mit/blob/main/CONVENTIONS.md An example of a well-formatted commit message for a documentation update, including a subject line and a detailed body. ```Text docs(CONVENTIONS): Update conventions file Add commit standards and interface stability rules. ``` -------------------------------- ### Example Output: Enabled git-mit Lints Source: https://github.com/purplebooth/git-mit/blob/main/README.md Shows the expected output format when listing only the enabled git-mit lints. ```text ╭───────────────────────────────────┬─────────╮ │ Lint ┆ Status │ ╞═══════════════════════════════════╪═════════╡ │ duplicated-trailers ┆ enabled │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ subject-not-separated-from-body ┆ enabled │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ subject-longer-than-72-characters ┆ enabled │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ body-wider-than-72-characters ┆ enabled │ ╰───────────────────────────────────┴─────────╯ ``` -------------------------------- ### Install Git MIT Hooks Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit-relates-to.md Installs the Git MIT hooks into the current Git repository. This command is necessary for `git mit-relates-to` and other Git MIT features to function. ```shell git mit-install ``` -------------------------------- ### Example git-mit Configuration File Content (TOML) Source: https://github.com/purplebooth/git-mit/blob/main/README.md Provides an example of the `$HOME/.config/git-mit/mit.toml` configuration file structure. It defines author initials (`ae`, `bt`, `se`) with their names, emails, and optional signing keys. This file is used by `git-mit` to look up author details. ```toml [ae] name = "Anyone Else" email = "anyone@example.com" [bt] name = "Billie Thompson" email = "billie@example.com" signingkey = "0A46826A" [se] name = "Someone Else" email = "someone@example.com" ``` -------------------------------- ### Initialize Git Repository (shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md Initializes a new Git repository in the current directory. This is the first step required before installing git-mit hooks. ```shell git init . ``` -------------------------------- ### Install git-mit Hooks (shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md Installs the git-mit commit hooks into the current Git repository. This command makes git-mit active for the repository. ```shell git mit-install ``` -------------------------------- ### Initializing Git Repository and Git-Mit Hooks - Shell Source: https://github.com/purplebooth/git-mit/blob/main/docs/lints/configuring.md Initializes a new Git repository in the current directory and installs the necessary git-mit hooks, which are required for the linting functionality to work. ```shell git init . git mit-install ``` -------------------------------- ### Install git-mit Hooks Globally (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/README.md Installs git-mit hooks globally by adding them to the git init template directory, affecting all newly initialized repositories. ```shell git mit-install --scope=global ``` -------------------------------- ### Project-Level Git-Mit Lint Configuration File - TOML Source: https://github.com/purplebooth/git-mit/blob/main/docs/lints/configuring.md Example content for a `.git-mit.toml.dist` file, which is used for sharing project-level lint configurations. Lints listed here with `true` are enabled for anyone using this configuration. ```toml [mit.lint] "pivotal-tracker-id-missing" = true ``` -------------------------------- ### Initialize Git Repository Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit-relates-to.md Initializes a new Git repository in the current directory. This is a prerequisite for installing Git hooks and making commits. ```shell git init . ``` -------------------------------- ### Example Commit Output with Relates-to Trailer (Text) Source: https://github.com/purplebooth/git-mit/blob/main/README.md Shows an example of the expected output from `git show` after using `git mit-relates-to`. It confirms that the 'Relates-to' trailer with the specified ID has been added to the commit message body. ```text author: [Billie Thompson billie@example.com] signed-by: [] --- Wrote a great README Relates-to: [#12321513] ``` -------------------------------- ### Bad Commit Example: Unconventional Format Source: https://github.com/purplebooth/git-mit/blob/main/CONVENTIONS.md An example of a poorly formatted commit message that does not follow the project's Conventional Commits standard. ```Text update conventions ``` -------------------------------- ### Good Commit Example: Breaking Change Feature Source: https://github.com/purplebooth/git-mit/blob/main/CONVENTIONS.md An example of a well-formatted commit message indicating a new feature with a breaking change, following the Conventional Commits standard. ```Text feat(api)!: remove deprecated endpoints ``` -------------------------------- ### Example Output: Status of Specific git-mit Lint Source: https://github.com/purplebooth/git-mit/blob/main/README.md Shows the expected output when checking the status of a specific git-mit lint, confirming if it is enabled. ```text ╭────────────────────────────┬─────────╮ │ Lint ┆ Status │ ╞════════════════════════════╪═════════╡ │ pivotal-tracker-id-missing ┆ enabled │ ╰────────────────────────────┴─────────╯ ``` -------------------------------- ### Example Commit Output with Co-authored-by Trailers (Text) Source: https://github.com/purplebooth/git-mit/blob/main/README.md Shows an example of the expected output from `git show` after using `git mit` with multiple initials. It confirms that the 'Co-authored-by' trailers for the specified authors have been added to the commit message body. Note that the 'Relates-to' trailer persists from a previous command. ```text author: [Anyone Else anyone@example.com] signed-by: [] --- Initial Commit Co-authored-by: Billie Thompson Co-authored-by: Someone Else Relates-to: [#12321513] ``` -------------------------------- ### Staging, Setting Author, and Committing with git-mit (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/README.md Demonstrates a typical commit workflow using `git-mit`. It stages changes, sets the primary author using `git mit`, and then creates a commit with a message. Requires `git-mit` to be installed and configured authors. ```shell git add README.md git mit bt git commit -m "Wrote a great README" ``` -------------------------------- ### Example of a broken TOML configuration file Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md Provides the content of a file intended to be a TOML configuration for git-mit authors, but which contains invalid syntax, used to demonstrate error handling. ```toml Hello, I am a broken file ``` -------------------------------- ### Local Git-Mit Lint Configuration Override File - TOML Source: https://github.com/purplebooth/git-mit/blob/main/docs/lints/configuring.md Example content for a `.git-mit.toml` file, which is used for local overrides of project-level or default lint configurations. Settings in this file take precedence over `.git-mit.toml.dist`. ```toml [mit.lint] "pivotal-tracker-id-missing" = false ``` -------------------------------- ### Available Authors List Output Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md An example of the text output generated by `git mit-config mit available`, showing a formatted table of configured authors with their initials, names, emails, and signing keys. ```text ╭─────────┬─────────────────┬────────────────────┬─────────────╮ │ Initial ┆ Name ┆ Email ┆ Signing Key │ ╞═════════╪═════════════════╪════════════════════╪═════════════╡ │ ae ┆ Anyone Else ┆ anyone@example.com ┆ None │ ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤ │ bt ┆ Billie Thompson ┆ billie@example.com ┆ 0A46826A │ ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤ │ jd ┆ Jane Doe ┆ jd@example.com ┆ None │ ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤ │ se ┆ Someone Else ┆ se@example.com ┆ None │ ╰─────────┴─────────────────┴────────────────────┴─────────────╯ ``` -------------------------------- ### Valid Commit Message with Trailers (Text) Source: https://github.com/purplebooth/git-mit/blob/main/docs/lints/index.md Example content for a commit message file demonstrating the correct format with unique 'Co-authored-by' and 'Signed-off-by' trailers, which should pass the 'duplicated-trailers' lint. ```text Demonstration Commit Message This is a commit message that has trailers and is valid Co-authored-by: Billie Thompson Signed-off-by: Someone Else ``` -------------------------------- ### Generated TOML Configuration Output Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md An example of the TOML output generated by `git mit-config mit generate` after temporarily adding or overriding authors. Shows how temporary settings are reflected in the output. ```toml [ae] name = "Anyone Else" email = "anyone@example.com" [bt] name = "Billie Thompson" email = "billie@example.com" signingkey = "0A46826A" [jd] name = "Jane Doe" email = "jd@example.com" [se] name = "Someone Else" email = "se@example.com" ``` -------------------------------- ### Invalid Commit Message with Duplicated Trailers (Text) Source: https://github.com/purplebooth/git-mit/blob/main/docs/lints/index.md Example content for a commit message file demonstrating duplicated 'Co-authored-by', 'Signed-off-by', and 'Relates-to' trailers, which is designed to fail the 'duplicated-trailers' lint. ```text Demonstration Commit Message This is a commit message that has trailers and is invalid Co-authored-by: Billie Thompson Co-authored-by: Billie Thompson Signed-off-by: Someone Else Signed-off-by: Someone Else Relates-to: #315 Relates-to: #315 ``` -------------------------------- ### git-mit-install Help Output (Non-Windows) Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/git-mit-install.md Shows the expected output of the `git-mit-install --help` command on non-Windows systems. It details the available options like `--scope`, `--completion`, `--home-dir`, `--help`, and `--version`, including their descriptions and possible values. ```text Install git-mit into a repository Usage: git-mit-install [OPTIONS] Options: -s, --scope [default: local] Possible values: - global: The home directory - local: The local folder --completion [possible values: bash, elvish, fish, powershell, zsh] --home-dir [env: HOME=/example/home/dir] -h, --help Print help (see a summary with '-h') -V, --version Print version ``` -------------------------------- ### Display git-mit-install Help (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/git-mit-install.md Executes the `git-mit-install` command with the `--help` flag to display usage information. It sets the `HOME` and `USERPROFILE` environment variables beforehand to simulate different user environments. ```shell export HOME="/example/home/dir" export USERPROFILE="F:\\some\\userprofile" git-mit-install --help ``` -------------------------------- ### git-mit-install Help Output (Windows) Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/git-mit-install.md Shows the expected output of the `git-mit-install --help` command on Windows systems. It details the available options, noting that the `--home-dir` option uses the `USERPROFILE` environment variable on Windows. ```text Install git-mit into a repository Usage: git-mit-install [OPTIONS] Options: -s, --scope [default: local] Possible values: - global: The home directory - local: The local folder --completion [possible values: bash, elvish, fish, powershell, zsh] --home-dir [env: USERPROFILE=F:\\some\\userprofile] -h, --help Print help (see a summary with '-h') -V, --version Print version ``` -------------------------------- ### Invalid Commit Message for JIRA Issue Key Lint (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/lints/index.md Provides an example of a commit message that *lacks* a valid JIRA Issue Key. This message content is used to demonstrate the failure case when the `jira-issue-key-missing` lint rule is enabled. ```shell demonstration Commit Message This is a commit message that is invalid ``` -------------------------------- ### Setting Relates-to Trailer with git-mit (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/README.md Sets the 'Relates-to' Git commit trailer using the `git mit-relates-to` command. This associates the commit with a specific issue or ticket ID. Requires the `git-mit-relates-to` binary to be installed and available in the PATH. ```shell git mit-relates-to "[#12321513]" ``` -------------------------------- ### Invalid Commit Message for Pivotal Tracker ID Lint (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/lints/index.md Provides an example of a commit message that *lacks* a valid Pivotal Tracker ID. This message content is used to demonstrate the failure case when the `pivotal-tracker-id-missing` lint rule is enabled. ```shell demonstration Commit Message This is a commit message that is invalid ``` -------------------------------- ### Valid Commit Message for JIRA Issue Key Lint (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/lints/index.md Provides an example of a commit message that includes a valid JIRA Issue Key (`JRA-123`), which will pass the `jira-issue-key-missing` lint check when enabled. This content is typically written to a file used by `git commit`. ```shell Demonstration Commit Message This is a commit message that is valid JRA-123 ``` -------------------------------- ### Displaying mit-pre-commit Help (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/mit-pre-commit.md Shows the command-line options and usage information for the `mit-pre-commit` hook binary. This command is useful for understanding available commands and parameters. ```shell mit-pre-commit --help ``` -------------------------------- ### Valid Commit Message for Pivotal Tracker ID Lint (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/lints/index.md Provides an example of a commit message that includes a valid Pivotal Tracker ID (`[#12345884]`), which will pass the `pivotal-tracker-id-missing` lint check when enabled. This content is typically written to a file used by `git commit`. ```shell Demonstration Commit Message This is a commit message that is valid [#12345884] # some comment ``` -------------------------------- ### Displaying Help for mit-prepare-commit-msg (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/mit-prepare-commit-msg.md Shows the command-line help message for the `mit-prepare-commit-msg` tool, detailing its usage, arguments, and options. This is useful for understanding how to use the hook binary. ```shell mit-prepare-commit-msg --help ``` -------------------------------- ### Displaying Main Help git-mit-config Shell Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/git-mit-config.md Shows the main help message for the `git-mit-config` command, listing available subcommands and global options. ```shell git-mit-config --help ``` -------------------------------- ### Displaying git-mit Help Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/git-mit.md Shows the command-line help message for the `git-mit` tool, listing available options, arguments, and common tasks. ```shell git-mit --help ``` -------------------------------- ### Generate Bash Completion for git-mit-install (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/git-mit-install.md Executes the `git-mit-install` command with the `--completion bash` flag to generate shell completion script for the Bash shell. This output can typically be sourced in a user's shell profile. ```shell git-mit-install --completion bash ``` -------------------------------- ### mit-pre-commit Help Output (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/mit-pre-commit.md The expected output when running `mit-pre-commit --help`. It describes the hook's purpose, general usage syntax, and lists the available command-line options like `--completion`, `-h`, and `-V`. ```shell Run first, before you even type in a commit message. It's used to inspect the snapshot that's about\nto be committed.\n\nUsage: mit-pre-commit [OPTIONS]\n\nOptions:\n --completion [possible values: bash, elvish, fish, powershell, zsh]\n -h, --help Print help\n -V, --version Print version ``` -------------------------------- ### mit-prepare-commit-msg Help Output (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/mit-prepare-commit-msg.md The standard output generated by running `mit-prepare-commit-msg --help`. It provides a comprehensive overview of the command's functionality, arguments, and available options with descriptions. ```shell This hook is invoked by git-commit right after preparing the default log message, and before the editor is started. Usage: mit-prepare-commit-msg [OPTIONS] [COMMIT_MESSAGE_PATH] [COMMIT_MESSAGE_SOURCE] [COMMIT_SHA] Arguments: [COMMIT_MESSAGE_PATH] The name of the file that contains the commit log message [COMMIT_MESSAGE_SOURCE] The commit message, and can be: message (if a -m or -F option was given to git); template (if a -t option was given or the configuration option commit.template is set in git); merge (if the commit is a merge or a `.git/MERGE_MSG` file exists); squash (if a `.git/SQUASH_MSG` file exists); or commit [COMMIT_SHA] Commit SHA-1 (if a -c, -C or --amend option was given to git) Options: --relates-to-exec A command to execute to get the value for the relates to trailer [env: GIT_MIT_RELATES_TO_EXEC=] --relates-to-template A template to apply to the relates to trailer [env: GIT_MIT_RELATES_TO_TEMPLATE=] --non-clean-behaviour-option A template to apply to the relates to trailer [env: GIT_MIT_SET_NON_CLEAN_BEHAVIOUR=] Possible values: - add-to: Change the commit message to include the current author - no-change: Do not change the commit message --completion [possible values: bash, elvish, fish, powershell, zsh] -h, --help Print help (see a summary with '-h') -V, --version Print version ``` -------------------------------- ### Help Output for git-mit-relates-to (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/git-mit-relates-to.md This snippet shows the expected output when running `git-mit-relates-to --help`, detailing the command usage, arguments, and options. ```shell Set Relates-to trailer. Usage: git-mit-relates-to [OPTIONS] [ISSUE_NUMBER] Arguments: [ISSUE_NUMBER] The issue number or other string to place into the Relates-to trailer Options: -t, --timeout Number of minutes to expire the configuration in [env: GIT_MIT_RELATES_TO_TIMEOUT=] [default: 60] --completion [possible values: bash, elvish, fish, powershell, zsh] -h, --help Print help -V, --version Print version ``` -------------------------------- ### Commit with Valid Capitalized Subject (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/lints/index.md Demonstrates committing changes with a commit message where the subject line starts with a capital letter. This commit is expected to succeed when the 'subject-line-not-capitalized' rule is enabled. ```shell echo $RANDOM > changes git add changes git commit --message="$(cat message)" ``` -------------------------------- ### Enable git-mit Subject Capitalization Lint (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/lints/index.md Enables the 'subject-line-not-capitalized' lint rule in the git-mit configuration. After running this command, git-mit will check if the commit subject line starts with a capital letter. ```shell git mit-config lint enable subject-line-not-capitalized ``` -------------------------------- ### Create Initial Commit with Co-authors (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md Creates a new file, stages it, commits it with a message, and then displays the commit details including author, signers, and body to show the added co-authored-by trailers. ```shell echo "# Hello, world!" > README.md git add . git commit --message="Initial Commit" --quiet git show --pretty='format:author: [%an %ae] signed-by: [%GS] --- %B' -q ``` -------------------------------- ### Displaying Help for git-mit-relates-to (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/git-mit-relates-to.md This command shows the help message for the git-mit-relates-to tool, listing available options and arguments. ```shell git-mit-relates-to --help ``` -------------------------------- ### Displaying Mit Subcommand Help git-mit-config Shell Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/git-mit-config.md Shows the help message for the `mit` subcommand of `git-mit-config`, detailing commands for managing author configuration. ```shell git-mit-config mit --help ``` -------------------------------- ### Disable git-mit Subject Capitalization Lint (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/lints/index.md Disables the 'subject-line-not-capitalized' lint rule in the git-mit configuration. After running this command, git-mit will no longer check if the commit subject line starts with a capital letter. ```shell git mit-config lint disable subject-line-not-capitalized ``` -------------------------------- ### Attempt Commit with Invalid Uncapitalized Subject (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/lints/index.md Attempts to commit changes with a commit message where the subject line does not start with a capital letter. This commit is expected to fail when the 'subject-line-not-capitalized' rule is enabled, demonstrating the lint rule's enforcement. ```shell echo $RANDOM > changes git add changes git commit --message="$(cat message)" ``` -------------------------------- ### Expected Output of Initial Commit (Text) Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md Shows the expected output from the `git show` command after the initial commit, demonstrating the added 'Co-authored-by' trailers for the selected authors. ```text author: [Anyone Else anyone@example.com] signed-by: [] --- Initial Commit Co-authored-by: Billie Thompson Co-authored-by: Someone Else ``` -------------------------------- ### Expected Output of Second Commit (Text) Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md Shows the expected output from the `git show` command after the second commit, demonstrating the updated 'Co-authored-by' trailers based on the environment variable configuration. ```text author: [Someone Else se@example.com] signed-by: [] --- Second Commit Co-authored-by: Anyone Else ``` -------------------------------- ### Re-initialize All Git Repositories Recursively (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/README.md Finds all .git directories under the user's home directory and re-initializes the parent repository, useful for updating hooks in existing repositories. ```shell find "$HOME" -type d -name .git -exec sh -c 'git init "$1"/..' -- {} \; ``` -------------------------------- ### Committing with Co-authors and Showing Output (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/README.md Demonstrates creating a new file, staging it, committing with a message, and then displaying the resulting commit message using `git show`. This verifies that the 'Co-authored-by' trailers set by `git mit` are correctly added to the commit. ```shell echo "# Hello, world!" > README.md git add . git commit --message="Initial Commit" --quiet git show --pretty='format:author: [%an %ae] signed-by: [%GS] --- %B' -q ``` -------------------------------- ### Displaying Help for mit-commit-msg (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/mit-commit-msg.md Shows the help message for the `mit-commit-msg` command, detailing its usage, arguments, and options. ```shell mit-commit-msg --help ``` -------------------------------- ### Displaying Relates-To Subcommand Help git-mit-config Shell Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/git-mit-config.md Shows the help message for the `relates-to` subcommand of `git-mit-config`, detailing commands for managing relates-to trailers. ```shell git-mit-config relates-to --help ``` -------------------------------- ### Displaying Lint Subcommand Help git-mit-config Shell Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/git-mit-config.md Shows the help message for the `lint` subcommand of `git-mit-config`, detailing commands for managing active lints. ```shell git-mit-config lint --help ``` -------------------------------- ### Attempt to run git-mit with a broken config file Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md Attempts to run the `git mit` command, specifying the broken TOML file as the configuration source, expecting an error due to the invalid file format. ```shell git mit -c "broken.toml" ae bt se ``` -------------------------------- ### Run git-mit with TOML Config File (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md Executes `git-mit` specifying an external TOML configuration file using the `-c` flag. This allows custom author configurations to be used. ```shell git mit -c "../git-mit.toml" ae bt se ``` -------------------------------- ### Verify signed commit details and authors Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md Shows the output of `git show` for the signed commit, verifying the author details and the presence of the GPG signature information. ```text author: [Billie Thompson billie@example.com] signed-by: [Billie Thompson ] --- Third Commit ``` -------------------------------- ### Run git-mit with Config via Environment Variable (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit.md Sets the `GIT_MIT_AUTHORS_CONFIG` environment variable to point to a TOML configuration file, then executes `git-mit` using the `-c` flag with the path from the environment variable. ```shell export GIT_MIT_AUTHORS_CONFIG="../git-mit.toml" git mit -c "$HOME/git-mit.toml" ae bt se ``` -------------------------------- ### mit-commit-msg Help Output (Shell) Source: https://github.com/purplebooth/git-mit/blob/main/docs/binaries/mit-commit-msg.md The standard output showing the usage information, arguments, and options available for the `mit-commit-msg` command. ```shell Validate the commit message that a user has input Usage: mit-commit-msg [OPTIONS] [COMMIT_FILE_PATH] Arguments: [COMMIT_FILE_PATH] Path to a temporary file that contains the commit message written by the developer Options: --copy-message-to-clipboard On lint failure copy the message to clipboard [env: GIT_MIT_COPY_MESSAGE_TO_CLIPBOARD=] --completion [possible values: bash, elvish, fish, powershell, zsh] -h, --help Print help -V, --version Print version ``` -------------------------------- ### Commit with Automatically Added Trailer Source: https://github.com/purplebooth/git-mit/blob/main/docs/mit-relates-to.md Stages the `README.md` file, sets the Git author/committer using `git mit bt`, and creates a commit. The 'Relates-to' trailer previously set by `git mit-relates-to` will be automatically appended. ```shell git add README.md git mit bt git commit -m "Wrote a great README" ```