Sha256: 9d02ada11da7a45a326f9dd7ecb61a2112d05bc6d51d362470ee1a6a77f5210a

Contents?: true

Size: 1019 Bytes

Versions: 13

Compression:

Stored size: 1019 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-ext-diff --no-color --staged` =~ /\+This change belongs to the first feature/ && `git diff --no-ext-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

13 entries across 13 versions & 2 rubygems

Version Path
mygithug-0.5.1 levels/stage_lines.rb
githug-0.5.0 levels/stage_lines.rb
githug-0.4.8 levels/stage_lines.rb
githug-0.4.7 levels/stage_lines.rb
githug-0.4.6 levels/stage_lines.rb
githug-0.4.5 levels/stage_lines.rb
githug-0.4.4 levels/stage_lines.rb
githug-0.4.3 levels/stage_lines.rb
githug-0.4.2 levels/stage_lines.rb
githug-0.4.1 levels/stage_lines.rb
githug-0.4.0 levels/stage_lines.rb
githug-0.3.5 levels/stage_lines.rb
githug-0.3.4 levels/stage_lines.rb