After running git reset --soft HEAD~1, what happens to the changes from the last commit?
Think about what --soft means for the staging area (index).
git reset --soft moves the HEAD pointer but keeps all changes staged in the index. This means you can recommit them immediately.
What is the effect of running git reset --hard HEAD~1 on your working directory?
Consider what --hard means for both index and working directory.
git reset --hard resets HEAD and makes both the index and working directory match the specified commit, discarding all changes.
Given a repository with one commit and some changes staged and unstaged, what is the state of the index and working directory after running git reset --mixed HEAD~1?
Remember --mixed resets the index but not the working directory.
git reset --mixed moves HEAD and resets the index to match that commit, but leaves working directory changes unstaged.
You accidentally ran git reset --hard HEAD~1 and lost the last commit. Which command can help you recover it?
Think about how Git tracks HEAD movements even after resets.
git reflog shows recent HEAD positions. You can reset back to a previous HEAD to recover lost commits.
You want to undo the last commit but keep your changes safe and ready to edit before recommitting. Which git reset mode should you use?
Consider which reset mode keeps changes staged for easy recommit.
git reset --soft moves HEAD but keeps changes staged, so you can edit and recommit easily without losing work.