Recover the Lost Files
Before starting this challenge, a Git repository has been initialized for you in the ~/project/important-project
directory. This repository contains several commits, including the creation and subsequent accidental deletion of two important files. Here's what you need to know:
- The repository was created with an initial commit adding a
README.md
file.
- Two crucial files,
important_algorithm.py
and crucial_data.txt
, were added in a subsequent commit.
- There were a few more commits with various changes.
- At some point,
important_algorithm.py
and crucial_data.txt
were accidentally deleted, and this deletion was committed.
- There has been at least one more commit after the accidental deletion.
Your task is to recover the deleted files by navigating the repository's history and then commit the recovered files.
Tasks
- Investigate the repository's history to find when
important_algorithm.py
and crucial_data.txt
were deleted.
- Restore the repository to the state just before the deletion.
- Keep the original commits and create a new commit with the message "Recover deleted files".
Requirements
- Work in the
~/project/important-project
directory.
- Ensure
important_algorithm.py
and crucial_data.txt
are present after recovery.
- Make sure the last commit message is "Recover deleted files", and the commit history is preserved.
Example
After successfully completing the challenge, running ls
in the project directory should show:
$ ls ~/project/important-project
important_algorithm.py crucial_data.txt README.md
Running git status
should show a clean working directory:
$ git status
On branch master
nothing to commit, working tree clean
And git log
should show your new commit at the top:
$ git log --oneline
8876d8b (HEAD -> master) Recover deleted files
9b3525c Update project status
5e6234c Oops, accidentally deleted important files
9de9506 Update algorithm TODO
01c36ae Add crucial data and algorithm
638a98d Initial commit