Creating a Branch

    • Learn how to create a local branch in a repository

    Create a Branch

    Let’s call our new branch ‘greet’.

    Notice that the git status command reports that you are on the ‘greet’ branch.

    lib/greeter.rb

    1. class Greeter
    2. def initialize(who)
    3. @who = who
    4. end
    5. def greet
    6. end
    7. end

    Changes for Greet: Modify the main program

    lib/hello.rb

    1. require 'greeter'
    2. # Default is World
    3. name = ARGV.first || "World"
    4. puts greeter.greet

    Update the Rakefile to use an external ruby process

    Rakefile

    1. #!/usr/bin/ruby -wKU
    2. task :default => :run
    3. task :run do
    4. ruby '-Ilib', 'lib/hello.rb'

    Up Next