Skip to main content

A git add/commit/push helper

Project description

git-commitflow - A Git Add, Diff, Commit, and Push Helper

License

Introduction

The git-commitflow tool is an interactive command-line interface that assists with the Git operations.

Running git-commitflow guides the user through the following interactive steps:

  • Prompting the user to add files (git add).
  • Displaying differences to ensure accuracy and prevent mistakes before committing (git diff).
  • Prompting the user to enter a commit message and then committing the changes (git commit).
  • It first attempts to merge using --ff-only; if the merge fails, it prompts the user to confirm whether to proceed with a rebase using --rebase and --autostash. Afterward, it commits the changes.
  • Optional (-p flag): Pushing updates to the remote repository (git push). The references are only pushed when they have never been pushed before. The git-commitflow tool maintains a list of references that have been pushed, preventing multiple pushes of the same reference. This reduces unnecessary pushes.

One significant benefit of the git-commitflow tool is that it enhances the user's awareness and control over their changes before committing. This reduces the likelihood of including unintended files or alterations in commits, promoting a cleaner and more organized version history.

When prompted for a commit message, the user can press the up arrow to quickly access previous messages, utilizing the readline prompt history. Additionally, pressing Ctrl-d will open the Git editor, similar to the behavior when executing git commit -a.

Additionally, the tool simplifies the workflow for adding, committing, and pushing changes, making the overall Git experience more efficient and user-friendly.

Requirements

  • git >= 2.6
  • Python and pip

Optional Python Dependencies

The git-commitflow CLI supports optional dependencies that extend its functionality. These extras can be installed based on environment requirements.

  • Colored Terminal Output (colors): Installs colorama to provide consistent cross-platform ANSI color support. This enhances the readability of standard output and error messages.

    pip install "git-commitflow[colors]"
    
  • Custom Process Title (proctitle): Installs setproctitle to rename the running process from python to git-commitflow. This simplifies identification and management in system monitoring tools such as top, htop, and ps.

    pip install "git-commitflow[proctitle]"
    

To install both extras at once, use a comma-separated list:

pip install "git-commitflow[colors,proctitle]"

Installation

Here is how to install git-commitflow using pip:

pip install --user git-commitflow

The pip command above will install the git-commitflow executable in the directory ~/.local/bin/.

Usage

Example usage

To use the tool within your Git repository, run:

git commitflow

This command will guide you through the following steps interactively:

  • Stage untracked files: Prompts you to git add any untracked files that haven't been staged.
  • Review changes: Displays a diff of your changes, allowing you to confirm whether you want to proceed with the commit.
  • Commit changes: Once you validate your commit message, the tool will finalize the commit.

If you also wish to push the changes, you can use the --push option:

git commitflow --push

(The references are pushed only if they have not been pushed previously. The git-commitflow tool keeps track of the references that have been pushed, preventing the same reference from being pushed multiple times. This minimizes redundant pushes.)

This will git add, diff, commit, push your changes to the remote repository after the commit.

Command-line arguments

usage: git-commitflow [--option] [args]

Readline manager.

options:
  -h, --help       show this help message and exit
  -p, --push       Git push after a successful commit

Customizations

Git configuration alias

To enhance your workflow, add the following aliases to your ~/.gitconfig file:

[alias]
ci = commitflow
cip = commitflow --push

With these aliases, you can conveniently use the commands git ci to commit changes and git cip to commit and push in a single step.

License

Copyright (c) 2020-2026 James Cherti

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_commitflow-1.2.1.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_commitflow-1.2.1-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file git_commitflow-1.2.1.tar.gz.

File metadata

  • Download URL: git_commitflow-1.2.1.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for git_commitflow-1.2.1.tar.gz
Algorithm Hash digest
SHA256 a5ab1e2f1c1e15d5cddf5dfa40e08cd7335c2f16cd29fe7a141f86ce79b5fb7b
MD5 c80d659190e4fe275855c249c221ae2e
BLAKE2b-256 d488819dd05dcdb9d1a42e4ff02cc48c030299b3a35abed053cff5caca9c7adc

See more details on using hashes here.

File details

Details for the file git_commitflow-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: git_commitflow-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 28.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for git_commitflow-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 923fac1fa217b4c12aeb7655c7a474893881779fd6866a0ce21e17ec860b831b
MD5 d065060857b8bf807419e52bacbeb06b
BLAKE2b-256 b5cc1d909f580f4aafb73326eddeb7be99d73eca2c38eb5e20e1d5159a0c1dec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page