This has saved my life so many times. Typically I have made a commit against develop branch by accident which I need to get rid of but also want to keep the changes in the commit so I can apply them to the correct branch. This is for local commits, you may have to set other options if you have pushed the commit to remote.
In Git Bash (and in the branch you want to roll back) this will roll back the last commit.
git reset --soft HEAD~1
Doco for git-reset https://git-scm.com/docs/git-reset