Answers for "unstage previous commit"

1

unstage previous commit

git reset --soft HEAD~1

Should do what you want. After this, 
you will have the first changes in the index (visible with git diff --cached), 
and your newest changes not staged. git status will then look like this:

# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   foo.java
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   foo.java

You can then do git add foo.java and commit both changes at once.
Posted by: Guest on June-07-2021

Code answers related to "unstage previous commit"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language