Sha256: 1f279882c8f05a9c40efae2ed23572f2c44ef9ca6a052af16f7928bb062a28e7

Contents?: true

Size: 763 Bytes

Versions: 1

Compression:

Stored size: 763 Bytes

Contents

difficulty 4
description "You decided to delete your latest commit by running `git reset --hard HEAD^` (not a smart thing to do). Now you changed your mind and want that commit back. Restore the deleted commit."

setup do
  repo.init
  FileUtils.touch 'file1'
  repo.add        'file1'
  repo.commit_all 'Initial commit'
  system "git branch -m master"

  FileUtils.touch 'file2'
  repo.add        'file2'
  repo.commit_all 'First commit'

  FileUtils.touch 'file3'
  repo.add        'file3'
  repo.commit_all 'Restore this commit'

  repo.git.native :reset, { "hard" => true }, 'HEAD^'
end

solution do
  return false unless File.exists?('file3')
  true
end

hint do
  puts "The commit is still floating around somewhere. Have you checked out `git reflog`?"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
githug-0.5.1 levels/restore.rb