0
0
Gitdevops~10 mins

Recovering lost commits with reflog in Git - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to show the reflog history.

Git
git [1]
Drag options to blanks, or click blank then click option'
Astatus
Breflog
Clog
Dbranch
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'git log' instead of 'git reflog' because 'log' shows commit history but not HEAD movements.
Using 'git status' which shows working directory status, not reflog.
Using 'git branch' which lists branches, not reflog.
2fill in blank
medium

Complete the command to reset HEAD to a specific reflog entry.

Git
git reset --hard [1]
Drag options to blanks, or click blank then click option'
Aorigin/main
BHEAD~1
CHEAD@{1}
Dmaster
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'HEAD~1' which refers to the parent commit, not reflog entry.
Using branch names like 'master' or 'origin/main' which do not refer to reflog entries.
3fill in blank
hard

Fix the error in the command to recover a lost commit by checking out a reflog commit.

Git
git checkout [1]
Drag options to blanks, or click blank then click option'
AHEAD~2
Borigin/HEAD
Cmain
DHEAD@{2}
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'HEAD~2' which is a commit parent reference, not reflog.
Using branch names which do not point to lost commits.
4fill in blank
hard

Fill both blanks to create a new branch from a lost commit found in reflog.

Git
git branch [1] [2]
Drag options to blanks, or click blank then click option'
Arecovered-branch
BHEAD@{3}
Cmain
Dorigin/main
Attempts:
3 left
💡 Hint
Common Mistakes
Using existing branch names instead of a new branch name.
Using branch names instead of reflog references for the commit.
5fill in blank
hard

Fill all three blanks to reset the current branch to a lost commit and clean working directory.

Git
git reset --[1] [2] && git clean -[3]
Drag options to blanks, or click blank then click option'
Ahard
BHEAD@{4}
Cf
Dsoft
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'soft' reset which keeps changes and does not fully recover state.
Using wrong reflog syntax or branch names.
Forgetting to force clean untracked files.