Skip to main content

pre-commit plugin to improve default commit messages when reverting reverts

Project description

reinstate-revert-revert

A tool for cleaning up reverted-revert git commit messages.

Simple Case

It will turn

Revert "Revert "Experiment on the flux capacitor""

This reverts commit deadc0dedeadc0dedeadc0dedeadc0dedeadc0de.

into

Reinstate "Experiment on the flux capacitor"

This reverts commit deadc0dedeadc0dedeadc0dedeadc0dedeadc0de.
And reinstates commit 0d15ea5e0d15ea5e0d15ea5e0d15ea5e0d15ea5e.

Complex Case

If you have gotten yourself into a bind, it will also convert this:

Revert "Revert "Revert "Revert "Revert "Experiment on the flux capacitor"""""

into this, making it easier to follow the chain:

Revert "Experiment on the flux capacitor"

This reverts commit deadc0dedeadc0dedeadc0dedeadc0dedeadc0de.
And reinstates commit 0d15ea5e0d15ea5e0d15ea5e0d15ea5e0d15ea5e.
And reverts 1337beef1337beef1337beef1337beef1337beef.
And reinstates 1337f0011337f0011337f0011337f0011337f001.
And reverts 1337c0de1337c0de1337c0de1337c0de1337c0de.

Though once you’re using this as a pre-commit plugin, you should never get to this case in the first place.

Installation

As a git hook

The simplest way to use this package is as a plugin to pre-commit.

A sample configuration:

# Without default_stages, all hooks run in all stages, which means all your
# pre-commit hooks will run in prepare-commit-msg. That is almost certainly
# not what you want. This example will run for the default hooks installed.
# You might have to adjust it for your environment, if you have changed those
# defaults.
default_stages:
  - commit
repos:
  # […]
  - repo: https://github.com/erikogan/reinstate-revert-revert
    rev: v1.0.3
    hooks:
      - id: reinstate-revert-revert
        stages:
          - prepare-commit-msg

By default, pre-commit does not install a hook for the prepare-commit-msg stage. You probably need to add it for this to work:

pre-commit install -t pre-commit -t prepare-commit-msg

As a standalone script

pip install reinstate-revert-revert

See reinstate-revert-revert --help for a full set of options.

reinstate-revert-revert takes log message file names as positional arguments.

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

reinstate-revert-revert-1.0.3.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

reinstate_revert_revert-1.0.3-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file reinstate-revert-revert-1.0.3.tar.gz.

File metadata

  • Download URL: reinstate-revert-revert-1.0.3.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/2.7.16 Darwin/18.7.0

File hashes

Hashes for reinstate-revert-revert-1.0.3.tar.gz
Algorithm Hash digest
SHA256 fa06c74b70c7232858d3434de0c80cb6ce3fa4db94f8840be77e262837037501
MD5 fc77733cf666d48e92496017b6bfdcd8
BLAKE2b-256 ab7c5e1e15dc69a213a21b941aebd5461ce73bba8d9778683dd78b5ad0d935de

See more details on using hashes here.

File details

Details for the file reinstate_revert_revert-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for reinstate_revert_revert-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f9d84c70e8df016b4c4afd6455eb74c53e3ad32d966fa851e7f2c371e341e49e
MD5 2327296413fb3cc84164c7d460e45fb3
BLAKE2b-256 8c8d669ff1a14654b8c20bcc60b66219ce6e293fda31f6b5f7ad253adb0f9450

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