Created
November 24, 2014 14:12
-
-
Save FUT/4cebdbd37602f8e81be1 to your computer and use it in GitHub Desktop.
Git config for a project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This file applies all the git configs and hooks related to current repository | |
# Run it from Rails.root directory this way: | |
# ./dev/git/apply.sh | |
cp -v dev/git/pre-commit .git/hooks/pre-commit | |
cp -v dev/git/config .git/config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[push] | |
default = simple | |
[core] | |
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol | |
autocrlf=true | |
repositoryformatversion = 0 | |
filemode = true | |
bare = false | |
logallrefupdates = true | |
ignorecase = true | |
precomposeunicode = true | |
[color] | |
ui = true | |
[color "diff"] | |
whitespace = red reverse | |
[remote "origin"] | |
url = [email protected]:expedite/expedite-rails.git | |
fetch = +refs/heads/*:refs/remotes/origin/* | |
[branch "master"] | |
remote = origin | |
merge = refs/heads/master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Checks the files to be committed for the presence of bad merges, debuger statmeents, etc, | |
# see FORBIDDEN for examples | |
# The array below can be extended for further checks | |
#add this into PROJECT_ROOT/.git/hooks/pre-commit | |
FILES_PATTERN='\.(rb|js|coffee)(\..+)?$' | |
FORBIDDEN=( binding.pry debugger '<<<<<<' '=======' '>>>>>>' ) | |
FILES=$(git diff --name-only HEAD | grep -v pre-commit | grep -v README) | |
for i in "${FORBIDDEN[@]}" | |
do | |
for f in $FILES | |
do | |
grep $i $f && echo 'COMMIT REJECTED Found' $i 'in' $f 'Please remove them before commiting' && exit 1 | |
done | |
done | |
exit 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment