Revisions
-
eladg revised this gist
Jun 14, 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 @@ -6,7 +6,7 @@ # and make sure it is executable. # The name of the file *must* be "pre-commit" for Git to pick it up. FORBIDDEN_BRANCHES = ["staging", "production", "sandbox"] branch = `git symbolic-ref --short HEAD`.strip -
eladg revised this gist
Jun 14, 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 @@ -8,7 +8,7 @@ FORBIDDEN_BRANCHES = ["staging", "production"] branch = `git symbolic-ref --short HEAD`.strip if (FORBIDDEN_BRANCHES.include?(branch)) puts -
eladg revised this gist
Jun 14, 2015 . 1 changed file with 1 addition and 7 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 @@ -8,13 +8,7 @@ FORBIDDEN_BRANCHES = ["staging", "production"] branch = `git symbolic-ref --short HEAD` if (FORBIDDEN_BRANCHES.include?(branch)) puts -
Simbul revised this gist
Feb 14, 2012 . 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 @@ #!/usr/bin/env ruby # This pre-commit hook will prevent any commit to forbidden branches # (by default, "staging" and "production"). # Put this file in your local repo, in the .git/hooks folder # and make sure it is executable. -
Simbul revised this gist
Feb 10, 2012 . 1 changed file with 1 addition 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 @@ -4,6 +4,7 @@ # (by default, "staging" and "production"). # 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. FORBIDDEN_BRANCHES = ["staging", "production"] -
Simbul created this gist
Feb 9, 2012 .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,28 @@ #!/usr/bin/env ruby # This pre-commit hook will prevent any commit on forbidden branches # (by default, "staging" and "production"). # Put this file in your local repo, in the .git/hooks folder # and make sure it is executable. FORBIDDEN_BRANCHES = ["staging", "production"] def current_branch() branches = `git branch --no-color`.split(/\n/) current = branches.select{ |b| b =~ /\s*\*/ }.first current.gsub(/[\*\s]/, "") end branch = current_branch if (FORBIDDEN_BRANCHES.include?(branch)) puts puts " STOP THE PRESS!" puts " You are trying to commit on the *#{branch}* branch." puts " Surely you don't mean that?" puts puts " If you really do, force the commit by adding --no-verify to the command." puts exit 1 end