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

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.0.tar.gz (25.3 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.0-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_commitflow-1.2.0.tar.gz
  • Upload date:
  • Size: 25.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for git_commitflow-1.2.0.tar.gz
Algorithm Hash digest
SHA256 1fb597c125791f6cf483de0cbb5bff080f5df47428191a30b0aced5234950b4c
MD5 4ef53e5885db0d4479276c5313fc586d
BLAKE2b-256 27215b3d4160ba3b50cc386d70599ba1e012c3dd6f99dd5ddba48eb1a14e6427

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_commitflow-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 27.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for git_commitflow-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43a5f4a67456496bff4f6a0f7bfce37716aa15a34aefac00e809f956e320727a
MD5 9c2069fc95fa3a6f2e6c07eeeb0a5539
BLAKE2b-256 850dbbb061e2217a06134a44e90e35f767647589b3dbbf3be99330f60edfadb7

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