How do I undo the last commit without losing changes? #169763
-
|
just committed but realized I need to edit some files before finalizing. How can I undo the last commit but keep my changes in the files? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
Just use this command in your terminal: NOTES: |
Beta Was this translation helpful? Give feedback.
-
|
You can undo the last commit but keep your changes staged with: git reset --soft HEAD~1Or keep changes unstaged (in working directory): git reset --mixed HEAD~1 |
Beta Was this translation helpful? Give feedback.
-
|
there are 2 files in the commit, i only want to revert 1 of them |
Beta Was this translation helpful? Give feedback.
Just use this command in your terminal:
NOTES:
--softkeeps your changes staged (ready to commit again).HEAD~1means “the last commit.” andHEAD~2means the commit before the last one