@@ -440,52 +440,48 @@ flowchart LR
440440 ```bash
441441 # List all stashes
442442 git stash list
443-
443+
444444 # Apply stash without removing it
445445 git stash apply
446-
446+
447447 # Apply a specific stash
448448 git stash apply stash@{1}
449-
449+
450450 # Create a named stash
451451 git stash save "WIP: adding UMAP plots"
452-
452+
453453 # Delete all stashes
454454 git stash clear
455455 ```
456456
457457### 12. ` git reset ` — Undoing a mistake
458458
459- Oops — Dr.X accidentally committed a large ** matrix.mtx** test file.
460- They unstage it first:
461-
462- ``` bash
463- git reset matrix.mtx
464- ```
465-
466- Then remove the bad commit:
467-
468- ``` bash
469- git reset --soft HEAD^
470- ```
459+ Oops — Dr. X accidentally committed a large ** matrix.mtx** test file.
471460
472- If they want to completely delete it (be careful!) :
461+ There are three types of reset :
473462
474- ``` bash
475- git reset --hard HEAD^
476- ```
463+ !!! terminal-2 "`--soft - : Undo commit, keep changes staged"
464+ ** Use when:** You want to recommit with a better message or add more files.
465+ ```bash
466+ # Undo last commit, keep changes in staging area
467+ git reset --soft HEAD^
468+ ```
477469
478- Reset moves the “HEAD pointer” to a previous commit — like discarding a failed experiment and reverting to known-good results.
470+ !!! terminal-2 "` --mixed ` (default): Undo commit, unstage changes"
471+
472+ ** Use when:** You want to redo the commit but need to modify files first.
473+ ```bash
474+ # Undo last commit, move changes back to working directory
475+ git reset HEAD^
476+ # or
477+ git reset --mixed HEAD^
478+ ```
479479
480- <center >
481- ``` mermaid
482- %%{init: {'theme': 'base'}}%%
483- gitGraph
484- commit id: "Good commit"
485- commit id: "Bad commit" tag: "HEAD"
486- %% reset --hard HEAD^ moves HEAD back one step
487- ```
488- </center >
480+ !!! terminal-2 "` --hard ` : Undo commit, delete changes"
481+ ```bash
482+ # Undo last commit and DELETE all changes (be careful!)
483+ git reset --hard HEAD^
484+ ```
489485
490486
491487## Common Questions
0 commit comments