Sha256: 78ad2d375b7090e81ac99a8bfccfdcc417bdf23318daba1f0dfd54ba26c66a6b

Contents?: true

Size: 601 Bytes

Versions: 13

Compression:

Stored size: 601 Bytes

Contents

difficulty 2
description "You committed too soon. Now you want to undo the last commit, while keeping the index."

setup do
  repo.init
  FileUtils.touch("README")
  repo.add("README")
  repo.commit_all("Initial commit")
  FileUtils.touch("newfile.rb")
  repo.add("newfile.rb")
  repo.commit_all("Premature commit")
end

solution do
  return false unless File.exists?("newfile.rb") && repo.status.files.keys.include?("newfile.rb")
  return false if repo.status.files["newfile.rb"].untracked || repo.commit_count > 1
  true
end

hint do
  puts "What are some options you can use with `git reset`?"
end

Version data entries

13 entries across 13 versions & 2 rubygems

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