Created
July 18, 2013 17:45
-
-
Save lkosak/6031354 to your computer and use it in GitHub Desktop.
Drop this in ~/.git/hooks/pre-push and run chmod +x ~/.git/hooks/pre-pus!
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 characters
#!/usr/bin/env ruby | |
local, remote = ARGV[0], ARGV[1] | |
address = remote.match(/git@(?<host>.*?):(?<account>.*?)\/(?<repo>.*?).git/) | |
branch = `git symbolic-ref HEAD`.strip.split('/').last | |
if(address[:host] == 'github.com' and branch != 'master') | |
puts "Pushing to http://github.com/#{address[:account]}/#{address[:repo]}/tree/#{branch}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm getting an error
jimmy@Jimmys-MacBook-Pro:~/Code/airbnb|phone_messaging_7⚡ ⇒ git push origin phone_messaging_7
.git/hooks/pre-push:4: undefined (?...) sequence: /git@(?.?):(?.?)/(?.*?).git/
error: failed to push some refs to '[email protected]:airbnb/airbnb.git'