Created
October 17, 2009 06:08
-
-
Save andrewle/212259 to your computer and use it in GitHub Desktop.
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
#! /usr/bin/env ruby | |
# A quick little ruby script to run in the shell to have your existing | |
# local branch track a remote branch | |
# Ex: git-track add origin master | |
# git-track remove origin master | |
if ARGV.empty? or ARGV.length < 3 | |
puts "USAGE: git-track [add|remove] <remote-name> <branch-name>\n\n" | |
exit | |
end | |
`git sh-setup require_work_tree` | |
case ARGV[0] | |
when 'add' | |
`git config --add branch.#{ARGV[2]}.remote #{ARGV[1]}` | |
`git config --add branch.#{ARGV[2]}.merge refs/heads/#{ARGV[2]}` | |
when 'remove' | |
`git config --unset branch.#{ARGV[2]}.remote` | |
`git config --unset branch.#{ARGV[2]}.merge` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment