class MergeBranch
Public Instance Methods
cmd()
click to toggle source
Returns a command appropriate for executing at the command line. For example:
git checkout master git merge --no-ff --log <branch>
# File lib/git-utils/merge_branch.rb, line 18 def cmd lines = ["git checkout #{target_branch}"] c = ["git merge --no-ff --log"] c << argument_string(unknown_options) unless unknown_options.empty? c << current_branch lines << c.join(' ') lines.join("\n") end
parser()
click to toggle source
# File lib/git-utils/merge_branch.rb, line 5 def parser OptionParser.new do |opts| opts.banner = "Usage: git merge-into-branch [branch] [options]" opts.on_tail("-h", "--help", "this usage guide") do puts opts.to_s; exit 0 end end end
Private Instance Methods
target_branch()
click to toggle source
Returns the name of the branch to be merged into. If there is anything left in the known options after parsing, that’s the merge branch. Otherwise, it’s the default branch.
# File lib/git-utils/merge_branch.rb, line 32 def target_branch self.known_options.first || default_branch end