Skip to content

Instantly share code, notes, and snippets.

View lvguowei's full-sized avatar

Guowei Lv lvguowei

View GitHub Profile
@lvguowei
lvguowei / pre-commit
Created February 17, 2016 07:48 — forked from kaushikgopal/pre-commit
pre-commit git hook - no "hacking"
#!/usr/bin/env ruby
# This pre-commit hook will prevent any commit with the work "hacking"
# Put this file in your local repo, in the .git/hooks folder
# and make sure it is executable.
# The name of the file *must* be "pre-commit" for Git to pick it up.
def current_branch()
branches = `git branch --no-color`.split(/\n/)
current = branches.select{ |b| b =~ /\s*\*/ }.first