GithubHelp home page GithubHelp logo

gitzooks's Introduction

Some Git Hooks
==============
By Nathan Gray

This is going to be a collection of git hooks that I find useful.  For now there are two.

Commit Exclusions
-----------------

I use this to reject any commit that adds the text "NOCOMMIT".  This allows me to throw crazy hacks into my code without fear that I'll overlook them at commit time.

Git Local Revision Number Hook
------------------------------

This is a git update hook that assigns each commit a monotonically increasing local revision number.  You can think of it a bit like bringing a little bit of subversiony goodness to git.  (He he he.)  Seriously, this kind of thing makes sense when you have a central authoritative repository and a need to communicate with users who don't use git (e.g. the QA department) and it can make git an easier sell in corporate environments.

To set this up on the server, install this script (or symlink it) to hooks/update in the bare git repo on your server.  Note that this is only designed to work on bare repos that are not committed to directly!

The revision numbers are attached to commits using git notes.  This requires a bit of setup if you want to see them on the client side.  We'll assume the authoritative repo is a remote called "origin".

1. Set up your client repo to pull notes from origin by adding this line to the [remote "origin"] section of the client's .git/config file:
    fetch = +refs/notes/*:refs/notes/origin/*

2. Set up your client repo to display all notes when showing git logs by adding a new section to the .git/config file:
  [notes]
      displayRef = *

3. After doing a push you won't find out what revision(s) the pushed commit(s) were assigned until your next pull.

gitzooks's People

Contributors

n8gray avatar

Stargazers

 avatar

Watchers

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