Giter Club home page Giter Club logo

.git_templates's Introduction

.git_templates

This repository is designed to provide a means for setting up global git hooks via hook templates.

Setup

  1. Clone this repository directly into your home directory:
    cd ~
    git clone [email protected]:chasms/.git_templates.git
    
  2. Set this repo up as your git template directory:
    git config --global init.templatedir '~/.git_templates'
    
  3. Install the git gem to enable scripting:
    gem install git
    

Usage

The hooks in this repository will automatically be installed in any newly initialized or newly cloned git repos.

To use them with an existing repository, run git init in that repository to reinitialize with the templated hooks.

In all cases, templated hooks will not overwrite existing hooks, either pre-existing or previously installed via these templates. This means that if you want to make changes to any hook template and want to see those changes carry over to that hook in a repository, you will need to delete the current hook in that repository's .git directory and then re-run git init.

Hooks

Name Function
post-commit This hook writes all commits to a commit_log.txt file located in your home directory. Formatting for commit logs is as follows: Wed, Sep 18 2019 01:48pm [repository:branch] commit message
prepare-commit-msg This hook will append the everything before the first / in a branch name to the beginning of the commit message e.g. branch JIRA-123/fix-routes with commit message Fixed route issues will create a final commit message [JIRA-123] - Fixed route issues (credit @dillonmcroberts)

Bonus

Add this function to your .bashrc or .bash_profile to make pulling up and searching commits as easy as typing commits into your terminal:

commits () {
  cat ~/commit_log.txt | grep "$*"
}

.git_templates's People

Contributors

chasms avatar

Stargazers

Josh Stillman avatar

Watchers

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