brainopia (owner)

Revisions

gist: 186522 Download_button fork
public
Public Clone URL: git://gist.github.com/186522.git
Embed All Files: show embed
git-track-branch #
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/env ruby
 
raise 'You need to specify remote repository by name' unless ARGV.first
 
remote = ARGV[0]
remote_branch = ARGV[1] || 'master'
current_branch = `git branch`.split("\n").find {|it| it[/^\*/] }[/[^* ]+/]
 
`git config branch.#{current_branch}.remote #{remote}`
`git config branch.#{current_branch}.merge refs/heads/#{remote_branch}`