Coder Social home page Coder Social logo

git-haken's Introduction

Haken: Git Hooks Reworked

For those of us who like git hooks, but not managing them.

Installation

If you are a homebrew user on OS X, this is available on a 'tap':

brew tap drench/moregit
brew install git-haken
git haken install

You can also set it up manually:

git clone git://github.com/drench/git-haken.git ~/.git-haken
git config --global init.templatedir ~/.git-haken/templates

From then on, any git repositories you create or clone will use this exciting alternate template and the hooks it contains.

To upgrade a tree you've already checked out:

cd some/boring/old/repo
rm -rf .git/hooks
git init

Haken comes with a few hooks that I endorse and use:

These hooks live in 17 subdirectories, one for each hook type: post-checkout hooks live under hooks/post-checkout.d/, pre-commit hooks go in hooks/pre-commit.d/, etc.

To learn more about the various hook types and what events trigger them, the githooks man page and the section on hooks in the Git Book are good places to start.

Unlike standard git hooks, where you are limited to one script per hook type, you can have as many scripts as you like for each type. If you want to put 15 scripts under .git/hooks/pre-commit.d/, I'd say it's kind of excessive, but git-haken won't stop you.

To disable a hook, remove its execute bit, or just delete the file. For example, if you don't find the pow hook useful, turn it off:

chmod -x .git_template/hooks/post-checkout.d/500-restart-pow.sh

Add your own!

You are a git user and I expect you to fork.

Write a hook in whatever language you like. Most hooks I've seen are shell or Perl scripts, but you could use just about anything: Ruby, Python, Node.js, PHP, even a binary compiled from C if that's what you're into.

License

MIT-style

git-haken's People

Contributors

drench avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.