Skip to content

Git Recovering From Common Mistakes

Master Git Recovering From Common Mistakes with 105 free flashcards. Study using spaced repetition and focus mode for effective learning in Programming.

🎓 105 cards ⏱️ ~53 min Advanced
Study Full Deck →
Share: 𝕏 Twitter LinkedIn WhatsApp

🎯 What You'll Learn

Preview Questions

12 shown

Undo the last commit but keep changes staged.

Show ▼

git reset --soft HEAD~1

Undo the last commit AND discard changes.

Show ▼

git reset --hard HEAD~1  ⚠ destructive.

Undo the last commit but keep changes unstaged in the working tree.

Show ▼

git reset --mixed HEAD~1 (the default).

Amend the last commit message.

Show ▼

git commit --amend -m 'new message'

Amend the last commit to include forgotten files.

Show ▼

git add forgotten-file
git commit --amend --no-edit

Discard local changes to a specific file.

Show ▼

git checkout -- file or modern: git restore file

Discard all local uncommitted changes.

Show ▼

git restore . followed by git clean -fd for untracked files.

Unstage a file you accidentally added.

Show ▼

git restore --staged file (or older: git reset HEAD file).

List untracked files that would be removed.

Show ▼

git clean -nd — dry-run.

Force-remove untracked files and directories.

Show ▼

git clean -fd  ⚠ destructive.

Recover a deleted commit you can no longer see.

Show ▼

git reflog to find its SHA, then git checkout -b rescue <sha>

Switch back to a previous commit temporarily.

Show ▼

git checkout <sha> (detached HEAD) — create a branch if you want to keep changes: git switch -c branch-name.

🎓 Start studying Git Recovering From Common Mistakes

🎮 Study Modes Available

🔄

Flashcards

Flip to reveal

🧠

Focus Mode

Spaced repetition

Multiple Choice

Test your knowledge

⌨️

Type Answer

Active recall

📚

Learn Mode

Multi-round mastery

🎯

Match Game

Memory challenge

Related Topics in Programming

📖 Learning Resources