0
0
Gitdevops~10 mins

Recovering from bad rebase 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 abort a bad rebase and return to the previous state.

Git
git rebase [1]
Drag options to blanks, or click blank then click option'
A--abort
B--continue
C--skip
D--edit-todo
Attempts:
3 left
💡 Hint
Common Mistakes
Using --continue continues the rebase instead of aborting.
Using --skip skips a commit but does not abort the whole rebase.
2fill in blank
medium

Complete the command to view the reflog, which helps find previous commit states after a bad rebase.

Git
git [1]
Drag options to blanks, or click blank then click option'
Astatus
Blog
Creflog
Dbranch
Attempts:
3 left
💡 Hint
Common Mistakes
Using git log shows commits but not the HEAD movement history.
git status shows current state but not history.
3fill in blank
hard

Fix the command to reset your branch to a previous commit found in reflog after a bad rebase.

Git
git reset --hard [1]
Drag options to blanks, or click blank then click option'
Aorigin/main
BHEAD@{3}
CHEAD~2
Dmaster
Attempts:
3 left
💡 Hint
Common Mistakes
Using HEAD~2 resets to two commits before current, which may not be the correct recovery point.
Using origin/main resets to remote branch, not local reflog state.
4fill in blank
hard

Fill both blanks to create a new branch from a previous commit to save work before fixing a bad rebase.

Git
git checkout -b [1] [2]
Drag options to blanks, or click blank then click option'
Arecovery-branch
BHEAD
CHEAD@{1}
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Using HEAD instead of HEAD@{1} may not point to the desired previous state.
Using main as the commit reference does not help recover the bad rebase state.
5fill in blank
hard

Fill all three blanks to reset your current branch to a previous commit and force push to update the remote after a bad rebase.

Git
git reset --hard [1] && git push [2] [3]
Drag options to blanks, or click blank then click option'
AHEAD@{2}
Borigin
C--force
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to use --force causes push to be rejected after rewriting history.
Using main instead of origin in push command is incorrect syntax.