How can I unstage my files again after making a local commit?


I have executed the following command

git add <>
git commit -m "add the file"

How can I delete my local commit now and unstage

If I type git reset --hard, I found that it reverts my modified to the original one.


git reset --soft HEAD~1 should do what you want. After this, you'll 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:
# 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:

You can then do git add and commit both changes at once.

See what's in a stash without applying it

How to "git pull" from master into the development branch