Sha256: 76ea798532d7ac2e49725ac0a66397c847815a1e3a96b69a729735ac2c6de996

Contents?: true

Size: 989 Bytes

Versions: 7

Compression:

Stored size: 989 Bytes

Contents

difficulty 4

description "You've made changes within a single file that belong to two different features, but neither of the changes are yet staged. Stage only the changes belonging to the first feature."

setup do
  repo.init
  File.open("feature.rb", "w") do |file|
    file.puts("this is the class of my feature")
  end

  repo.add("feature.rb")
  repo.commit_all("Added initial feature file")

  File.open("feature.rb", "a") do |file|
    file.puts("This change belongs to the first feature")
  end

  File.open("feature.rb", "a") do |file|
    file.puts("This change belongs to the second feature")
  end
end

solution do
  `git diff --no-color --staged` =~ /\+This change belongs to the first feature/ && `git diff --no-color` =~ /\+This change belongs to the second feature/
end

hint do
  puts "You might want to try to manipulate the hunks of the diff to choose which lines of the diff get staged. Read about the flags which can be passed to the 'add' command; man git-add."
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
githug-0.2.7 levels/stage_lines.rb
githug-0.2.6 levels/stage_lines.rb
githug-0.2.5 levels/stage_lines.rb
githug-0.2.4 levels/stage_lines.rb
githug-0.2.3 levels/stage_lines.rb
githug-0.2.2 levels/stage_lines.rb
githug-0.2.1 levels/stage_lines.rb