Class | Git::Branch |
In: |
lib/git/branch.rb
|
Parent: | Path |
full | [RW] | |
name | [RW] | |
remote | [RW] |
# File lib/git/branch.rb, line 9 def initialize(base, name) @remote = nil @full = name @base = base parts = name.split('/') if parts[1] @remote = Git::Remote.new(@base, parts[0]) @name = parts[1] else @name = parts[0] end end
# File lib/git/branch.rb, line 23 def gcommit @gcommit = @base.object(name) if !@gcommit @gcommit end
g.branch(‘new_branch’).in_branch do
# create new file # do other stuff return true # auto commits and switches back
end
# File lib/git/branch.rb, line 39 def in_branch (message = 'in branch work') old_current = @base.lib.branch_current checkout if yield @base.commit_all(message) else @base.reset_hard end @base.checkout(old_current) end