Hands-on task
Recover a lost commit via reflog
The project repo lives in GitLab and is cloned to /root/repo (the web sign-in is on the GitLab tab). The develop branch had a commit add important with the file important.txt. By mistake you ran git reset --hard HEAD~1 and git push --force: the commit is gone both from your local develop and from GitLab.
Restore that very lost commit: the develop branch must point at it again — both locally and in GitLab, important.txt must come back with its old contents, and develop's history must have two commits. Find the lost commit through the reference log.
- git reflog
- recovering commits
- reset --hard
- HEAD@{n}
- force push
- GitLab