In this repository we had added the holy grail in holygrail.txt
. Unfortunately, we reset our master
branch to the initial commit. Now it is time to recover from the mistake.
- Run
source setup.sh
(or.\setup.ps1
in PowerShell)
We just reset the master
branch to the initial commit. We will recover the lost work.
- Use
git log
to see that the history is brief - Use
ls
to verify thatholygrail.txt
is not in the workspace - Use
git reflog
to find the commit that addedholygrail.txt
- Use
git reset --hard
to recover our history and work - Use
git log
andls
to see the recovered work - Undo your solution by running
git reset --hard initial-commit
- Use
git cherry-pick
to restoreholygrail.txt
- Compare history and workspace to the solution using reset
- Again, undo your solution using
git reset --hard initial-commit
- Force the Git garbage collector to run with
git gc
- Try to restore the holy grail using one of the previous solutions
git reflog
git cherry-pick
git reset --hard
git log