[GIT] undo commits and keep the changes [before pushed] 

// When you update your project, sometimes you submitted a couple of commits but those were related to exactly one feature/function. At that moment you can group all the commits into one for explaining more clearly what you did.
// And you should do
git reset --soft [the remote branch]
// *** [--hard] will make your code change disappear and all coding will just be the same as the git remote branch.

// Output
# On branch XXXXXX
# Your branch is up to date with 'origin/XXXXXX'
# 
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#    modified: xxxxxxxx
#    modified: xxxxxxxx

// Commit it at once finally
git commit -m "explain what did you do now"
git push

// Done
Back