Method: Git::Branch#in_branch
- Defined in:
- lib/git/branch.rb
#in_branch(message = 'in branch work') ⇒ Object
g.branch(‘new_branch’).in_branch do
# create new file
# do other stuff
return true # auto commits and switches back
end
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/git/branch.rb', line 40 def in_branch ( = 'in branch work') old_current = @base.lib.branch_current checkout if yield @base.commit_all() else @base.reset_hard end @base.checkout(old_current) end |