GithubHelp home page GithubHelp logo

squasher's Introduction

Squasher for Auto-Committed Git Repositories

https://img.shields.io/badge/cachix-akirak-blue.svg

This is a command line program that addresses a very particular need: squash Git commits that are automatically created (e.g. using git-auto-commit-mode for Emacs). It squashes a consecutive sequence of commits that have the same commit message into one commit. It also checks the author time of each commit, so if a commit is not authored within a certain duration (e.g. three hours) since the first commit of the sequence, it is not squashed, even if it has the same commit message.

Squashing is applied to commits between the head and its remote branch (i.e. origin/BRANCH unless the branch has a specific remote).

This is useful for keeping the history less messy, while frequently backing up changes to the Git repository.

Installation

It is a Go program, so you can build and install the program using Go.

Alternatively, you can use Nix with flakes enabled to run the program:

nix run github:akirak/squasher -- --help

Usage

Synopsis:

squasher [--base SHA] [--hours N] [DIR]

It takes an optional positional argument, which should be a path to a Git repository. By default, it is the current repository.

If --base is set, squashing starts from the commit instead of origin/BRANCH. You must give a full hash of a commit.

--hours option specifies the duration threshold in hours.

It rewrites the history of the head branch of a Git repository, so please use it with caution. As a safety net, it checks the status of the repository and aborts the operation if it is not clean.

To automate squashing, you can create a pre-push hook or your Git repository.

squasher's People

Contributors

akirak avatar

Watchers

 avatar  avatar

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.