Sha256: 422c2dad0a6b3b802eb1cc401265d8ff7b53a502532da08a4ede927c7f021b81

Contents?: true

Size: 601 Bytes

Versions: 7

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

7 entries across 7 versions & 1 rubygems

Version Path
githug-0.3.3 levels/reset_soft.rb
githug-0.3.2 levels/reset_soft.rb
githug-0.3.1 levels/reset_soft.rb
githug-0.3.0 levels/reset_soft.rb
githug-0.2.12 levels/reset_soft.rb
githug-0.2.11 levels/reset_soft.rb
githug-0.2.10 levels/reset_soft.rb