Git Product home page Git Product logo

git-cc's Introduction

git-cc

A git extension to help write conventional commits

GitHub go.mod Go version Go report card Buy a commercial license

Usage

demo

# you can invoke either of the below to
# interactively write a conventional commit
git cc
git cc feat          # start after the commit-type
git cc 'feat(scope)' # start after the scope

# or validate your conventional commit
git cc feat: added conventional commits # ok! creates a commit
git cc 'feat(cli): added a conventional commit' # ok! creates a commit
git cc feat add a typo  # starts interaction at the scope
git cc -m "invalid(stuff): should return 1"

Configuration

git-cc searches for a configuration file named commit_convention.{yaml,yml,toml}. Note that git-cc prefers the extension yaml over yml, and yml over toml.

git-cc searches the following directories for a configuration file in this order:

${PWD}/
${REPO_ROOT}/         # ignored if not inside a git repo
${REPO_ROOT}/.config/ # ignored if not inside a git repo
${XDG_CONFIG_HOME}/

See ./config/commit_convention.yaml for an example configuration file.

Why write conventional commits through an interactive CLI?

Figuring out what to write for an informative commit can be difficult. The conventional commits standard helps figure out what to write. As a bonus, conventional commits facilitate generating changelogs and semantic version increments. An interactive command-line application helps with following the standard.

Licensing

For the details, see ./LICENSE.md.

git-cc is source-provided software, not open-source software: it's offered under either the PolyForm Free Trial 1.0.0 license, the PolyForm Noncommercial 1.0.0 license, or a per-developer commercial license. This means anyone can use the software for noncommercial purposes and trial the software for commercial use for a month. Anyone using the software to make money after their trial expires needs to purchase a commercial license.

You can purchase a commercial license via a one-time GitHub sponsorship.

Prior licenses apply to previous versions of git-cc.
  • From 2021-08-25 to 2023-11-14, git-cc was offered under the Indie Code Catalog Standard Deal, version 4.0.1 or higher. The licenses can be found at commit b682f27e. IndieCC shut down, prompting relicensing.

  • From 2020-11-23 to 2021-08-25, git-cc was licensed under the strictEq free and paid licenses. The licenses can be found at commit 7ca8e95. StrictEq rebranded to indieCC, prompting relicensing.

If you bought an indieCC or strictEq paid license, that license still grants you rights to copy and use updated versions git-cc even after the license change.

Installation

Manual installation

Go to the project releases page to download the appropriate packaging format. Please verify the shasum of the downloaded executable for you before you run it.

Using brew

brew tap skalt/git-cc
brew install git-cc

Using the installer script for Linux or Mac

First, take a second to verify that the installer script would correctly check the shasum of the downloaded package. Then, run the following commands:

repo=skalt/git-cc
branch=master
curl -sL https://raw.githubusercontent.com/$repo/$branch/scripts/install.sh > /tmp/install.sh
shasum -a 256 /tmp/install.sh | sed 's/^/# /g'
# 805354a9b0db5648af785086af5a4af036d5281ea5999bda055c888186d36cd7  /tmp/install.sh
chmod +x /tmp/install.sh
/tmp/install.sh --help | sed 's/^/# /g'
# USAGE: ./install.sh [-h|--help] [--download-only|--dry-run] [FMT]
# download a release of git-cc for your OS and instruction set architecture.
#
# ARGS:
#   -h|--help        print this message and exit
#   --download-only  download as FMT, but do not install
#   --dry-run        print rather than follow the download url for the binary
#   FMT              The download format. Valid values are
#                      - tar.gz (default)
#                      - apk
#                      - brew
#                      - deb
#                      - exe
#                      - rpm
/tmp/install.sh

From source with go

To compile from source, run make install inside the source directory. You'll need to have a go >= 1.19 toolchain and to have your $GOPATH/bin on your $PATH.

Prior art:

git-cc's People

Contributors

brainwo avatar dependabot[bot] avatar lincolnjpg avatar skalt avatar tanducmai 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

Watchers

 avatar  avatar  avatar

git-cc's Issues

Unable to create custom scopes using CLI

I tried to create new scopes using the CLI and after typing scope's name and hit enter, scope was not created and no response was given. After looking into the code, I found the reason: $EDITOR is not set and vi is not installed in my system

feature request: `--redo` flag

Often, I find myself doing

git cc -m "feat: ..." 
echo "pre-commit hooks rejected my commit"
# make fixes
git commit -m "$(cat ./.git/COMMIT_EDITMSG)"

It would be nice to encode this workflow as git cc --redo

feature request: make adding new scopes/types easier

When I want to enter a new commit-type or scope, I have to

  • remember what the new item was called
  • write out the new item in the appropriate place in the configuration document.

I'd like to

  • have the new item copied to my clipboard so that I don't have to remember it
  • if possible, place my cursor at the appropriate location within the config document
  • if possible, place a template entry for the new item within the config document at the right location

Error when installing (`arch: command not found`)

I tried to install following the README guide:

repo=skalt/git-cc
branch=master
curl -sL https://raw.githubusercontent.com/$repo/$branch/scripts/install.sh | sh

I got this error:

main: line 77: arch: command not found

Write some end-to-end tests

Not having a good test suite is a perpetual source of shame. To prevent further dishonor:

  • research how to test bubbletea applications
  • test at least the selectors
  • run the tests in github actions

selector lines get mangled on each keystroke on small terminals

On small terminals (I'm not yet sure what exact column width) each keystroke prints extra lines. This is likely due to how line-wrapping and listening for terminal resizing works in pkg/single_select.

select a commit type:
select a commit type:
select a commit type:
select a commit type:
select a commit type:
   type to select
   feat     adds a new feature
   fix      fixes a bug
   docs     changes only the documentation
   style    changes the style but not the meaning of the code (such as formatting)
 > perf     improves performance
   test     adds or corrects tests
   build    changes the build system or external dependencies
   chore    changes outside the code, docs, or tests
   ci       changes to the Continuous Inegration (CI) system
   refactor changes the code without changing behavior
   revert   reverts prior changes

submit: tab/enter; navigate: up/down; cancel: ctrl+c

RFC: rename the binary to `git-conventional-commit`, retaining `git-cc` as a symlink/alias

The name git-cc doesn't tell you what it does. cc could stand for anything, from email's carbon-copy to cubic centimeters. Worse still, cc is impractically short for tab-completion. git c<tab> brings up all the git subcommand which start with c, with cc somewhere below the top of the list.

Proposal: rename the binary to git-conventional-commit, with git-cc retained as a symlink and/or git-alias. That way, git conv<tab> will complete to git conventional-commit without additional configuration, while git cc [...] will still work normally. Based on my initial experimentation, symlinking git-conventional-commit -> git-cc breaks git tab-completion in bash/zsh, likely due to the symlink's file-mode being different than just a user-executable file: I got lrwxrwxrwx

To avoid renaming the binary, you could git config --global alias.conventional-commit 'cc'. However, that's another installation step in a tool that's meant to be maximally convenient.

To my ~1-2 users: Thoughts?

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.