Last active
November 2, 2015 21:07
-
-
Save bloc40/9854256c28bff376e28f to your computer and use it in GitHub Desktop.
Revisions
-
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -37,6 +37,6 @@ git init ``` ### Or run it for all applications together: ``` cd ~/src for dir in *; do cd $dir; git init; done ``` -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -34,4 +34,9 @@ git config --global init.templatedir '~/.git_template' navigate to the project, then: ``` git init ``` ### Or run it for all applications together: ``` cd src for dir in *; do cd $dir; git init; done ``` -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -27,7 +27,7 @@ chmod a+x ~/.git_template/hooks/prepare-commit-msg ### Tell Git where to find the hooks ```ruby git config --global init.templatedir '~/.git_template' ``` ### To add the custom hook to a project -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ ### Create a directory to hold Git hooks ``` mkdir -p ~/.git_template/hooks/ ``` ### Add This file to ~/.git_template/hooks/prepare-commit-msg -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -25,10 +25,9 @@ fi chmod a+x ~/.git_template/hooks/prepare-commit-msg ``` ### Tell Git where to find the hooks ```ruby git config --global init.templatedir '~/.code/.git_template' ``` ### To add the custom hook to a project -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ fi ``` ### Make the file executable ``` chmod a+x ~/.git_template/hooks/prepare-commit-msg ``` ### Add this lines to the bottom of .gitconfig -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 9 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ ### Create a directory to hold Git hooks ```ruby mkdir -p ~/.git_template/hooks/ ``` ### Add This file to ~/.git_template/hooks/prepare-commit-msg ```ruby #!/bin/sh @@ -28,5 +28,11 @@ chmod a+x ~/.git_templates/hooks/prepare-commit-msg ### Add this lines to the bottom of .gitconfig ```ruby [init] templatedir = ~/.git_template ``` ### To add the custom hook to a project navigate to the project, then: ``` git init ``` -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ if [ -n "$BRANCH_NAME" ] && ! [[ $BRANCH_EXCLUDED -eq 1 ]] && ! [[ $BRANCH_IN_CO fi ``` ### Make the file executable ``` chmod a+x ~/.git_templates/hooks/prepare-commit-msg ``` -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -20,6 +20,10 @@ if [ -n "$BRANCH_NAME" ] && ! [[ $BRANCH_EXCLUDED -eq 1 ]] && ! [[ $BRANCH_IN_CO sed -i.bak -e "1s/^/[$BRANCH_NAME] /" $1 fi ``` ### Make the file executable ```ruby chmod a+x ~/.git_templates/hooks/prepare-commit-msg ``` ### Add this lines to the bottom of .gitconfig ```ruby -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ ### Create a directory to hold Git hooks ```ruby mkdir -p ~/.git_templates/hooks/ ``` ### Add This file to ~/.git_templates/hooks/prepare-commit-msg ```ruby #!/bin/sh -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ### Add This file to ~/.git_templates/prepare-commit-msg ```ruby #!/bin/sh @@ -16,4 +16,10 @@ BRANCH_IN_COMMIT=$(grep -c "\[$BRANCH_NAME\]" $1) if [ -n "$BRANCH_NAME" ] && ! [[ $BRANCH_EXCLUDED -eq 1 ]] && ! [[ $BRANCH_IN_COMMIT -ge 1 ]]; then sed -i.bak -e "1s/^/[$BRANCH_NAME] /" $1 fi ``` ### Add this lines to the bottom of .gitconfig ```ruby [init] templatedir = ~/.git_templates ``` -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ ### Add This file to ~/.git_templates ```ruby #!/bin/sh if [ -z "$BRANCHES_TO_SKIP" ]; then -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ ### Add This file to ~/.git_templates ``` #!/bin/sh if [ -z "$BRANCHES_TO_SKIP" ]; then -
bloc40 renamed this gist
Nov 2, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ ### Add This file to ~/.git_templates ```ruby #!/bin/sh if [ -z "$BRANCHES_TO_SKIP" ]; then -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ ### Add This file to ~/.git_templates ``` #!/bin/sh if [ -z "$BRANCHES_TO_SKIP" ]; then @@ -14,4 +15,4 @@ BRANCH_IN_COMMIT=$(grep -c "\[$BRANCH_NAME\]" $1) if [ -n "$BRANCH_NAME" ] && ! [[ $BRANCH_EXCLUDED -eq 1 ]] && ! [[ $BRANCH_IN_COMMIT -ge 1 ]]; then sed -i.bak -e "1s/^/[$BRANCH_NAME] /" $1 fi ``` -
bloc40 revised this gist
Nov 2, 2015 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ ### Add This file to #!/bin/sh if [ -z "$BRANCHES_TO_SKIP" ]; then BRANCHES_TO_SKIP=(master develop) fi @@ -13,4 +14,4 @@ BRANCH_IN_COMMIT=$(grep -c "\[$BRANCH_NAME\]" $1) if [ -n "$BRANCH_NAME" ] && ! [[ $BRANCH_EXCLUDED -eq 1 ]] && ! [[ $BRANCH_IN_COMMIT -ge 1 ]]; then sed -i.bak -e "1s/^/[$BRANCH_NAME] /" $1 fi -
bloc40 created this gist
Nov 2, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ #!/bin/bash ``` if [ -z "$BRANCHES_TO_SKIP" ]; then BRANCHES_TO_SKIP=(master develop) fi BRANCH_NAME=$(git symbolic-ref --short HEAD) BRANCH_NAME="${BRANCH_NAME##*/}" BRANCH_EXCLUDED=$(printf "%s\n" "${BRANCHES_TO_SKIP[@]}" | grep -c "^$BRANCH_NAME$") BRANCH_IN_COMMIT=$(grep -c "\[$BRANCH_NAME\]" $1) if [ -n "$BRANCH_NAME" ] && ! [[ $BRANCH_EXCLUDED -eq 1 ]] && ! [[ $BRANCH_IN_COMMIT -ge 1 ]]; then sed -i.bak -e "1s/^/[$BRANCH_NAME] /" $1 fi ```