Giter VIP home page Giter VIP logo

increment-commit-hash's Introduction

increment-commit-hash

Auto replaces commit hash prefix incrementally with lucky-commit by hooking post-commit.

increment-commit-hash

See all demonstrations in this repository's commit history.

Installation

In order for this scenario to work, lucky_commit is required to be installed on your machine.

Local

To set up automatically in your local project:

$ curl -sL https://github.com/dwisiswant0/increment-commit-hash/raw/master/setup.sh | bash

This will add a post-commit hook for your git project. So every time you commit something, lucky_commit will run after it.

Global

Global means it applies to all your git projects and to install it you have to do-it-yourself (DIY) manually.

Add a Bash function for git alias command inside your .bash_aliases file:

git() {
	command git "${@}"
	[[ "${?}" -eq 0 ]] || return

	local COUNT=$(command git rev-list HEAD --count 2>/dev/null)
	local HASH=$(printf "%07d" "${COUNT}")

	[[ "${1}" == "commit" ]] && lucky_commit "${HASH}"
}

For the alias to trigger when you run git command, you need to either restart the terminal or evaluate directly with:

$ source $HOME/.bash_aliases

After that, the lucky_commit command will be executed in any git project after git commit subcommand w/o having to add post-commit hooks in your projects 1-by-1.

Uninstalling

To delete that alias, simply remove those git function from .bash_aliases file and restart your terminal session or unaliasing with:

$ unalias git

increment-commit-hash's People

Contributors

dwisiswant0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

chriss-0x01

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.