Class: Git::Remote
- Inherits:
-
Object
- Object
- Git::Remote
- Defined in:
- lib/git/remote.rb
Overview
A remote in a Git repository
Instance Attribute Summary collapse
-
#fetch_opts
Returns the value of attribute fetch_opts.
-
#name
Returns the value of attribute name.
-
#url
Returns the value of attribute url.
Instance Method Summary collapse
- #branch(branch = @base.current_branch)
- #fetch(opts = {})
-
#initialize(base, name) ⇒ Remote
constructor
A new instance of Remote.
-
#merge(branch = @base.current_branch)
merge this remote locally.
- #remove
- #to_s
Constructor Details
#initialize(base, name) ⇒ Remote
Returns a new instance of Remote.
8 9 10 11 12 13 14 |
# File 'lib/git/remote.rb', line 8 def initialize(base, name) @base = base config = @base.lib.config_remote(name) @name = name @url = config['url'] @fetch_opts = config['fetch'] end |
Instance Attribute Details
#fetch_opts
Returns the value of attribute fetch_opts.
6 7 8 |
# File 'lib/git/remote.rb', line 6 def fetch_opts @fetch_opts end |
#name
Returns the value of attribute name.
6 7 8 |
# File 'lib/git/remote.rb', line 6 def name @name end |
#url
Returns the value of attribute url.
6 7 8 |
# File 'lib/git/remote.rb', line 6 def url @url end |
Instance Method Details
#branch(branch = @base.current_branch)
26 27 28 29 |
# File 'lib/git/remote.rb', line 26 def branch(branch = @base.current_branch) remote_tracking_branch = "#{@name}/#{branch}" Git::Branch.new(@base, remote_tracking_branch) end |
#fetch(opts = {})
16 17 18 |
# File 'lib/git/remote.rb', line 16 def fetch(opts = {}) @base.fetch(@name, opts) end |
#merge(branch = @base.current_branch)
merge this remote locally
21 22 23 24 |
# File 'lib/git/remote.rb', line 21 def merge(branch = @base.current_branch) remote_tracking_branch = "#{@name}/#{branch}" @base.merge(remote_tracking_branch) end |
#remove
31 32 33 |
# File 'lib/git/remote.rb', line 31 def remove @base.lib.remote_remove(@name) end |
#to_s
35 36 37 |
# File 'lib/git/remote.rb', line 35 def to_s @name end |