Here, you’ll find some tips on how to add (review and merge) a change to Gerrit. And a list of common pitfalls. Article is focused on detailed flow of described process with a short version (checklist) of it provided at the very end of this long text.
This is the short version of “Remove sensitive data” article in GitHub Help. And an alternative solution to the one presented [here](Remove file from repository and from all revisions.txt). It assumes, that you are the only collaborator to repository, so you can perform steps at once (you don’t have to contact others and wait until they rebase your changes) and that your repository doesn’t use tags, so you don’t have to perform all steps.
If any these two assumptions is not correct in your case, then avoid this article and rather follow to mentioned article. Keep in mind, however, that in some certain situations, you have to contact GitHub Support in order to finish entire procedure.
There are probably thousands of websites telling you, how to undo the last Git commit. For example, one of the most voted up questions on Stack Overflow. But none of them (or actually nearly none of them) answers, how to do this using
git undo-commit. Simply because, such command does not exist! :> Therefore, the title of this text should rather sound “Defining own Git alias to undo last Git commit“, since this article is focused on git aliases rather than on undoing last commit in Git.