I know this has been asked and discussed earlier, but I couldn´t find the right workflow for this problem.
Let´s say I´m working on a new project that I want to push to GitHub.
After a few commits and pushes that worked well, I continue coding and editing and at some point I add some big files larger than 100MB to my project (without knowing or keeping in mind that this will cause problems when I will try to push it in the next step).
So I do:
git add .
git commit -m 'some commit message'
git revert …
This achieves the same effect as Joe A's answer except its a lot simpler and in my view it's a lot safer for someone unfamiliar with the area.
git reset --soft HEAD~
This will undo the commit but leave all the things that would have been committed as staged.
git rm the files that shouldn't have been committed and then re-commit.
Now you should be able to push.
Note there is nothing technically wrong with Joe's answer and I have upvoted it; it's just overkill and overly complicated for such a simple problem. However if your commit chain included n>1 commits Joe's answer would be your best option. So this is more like a special case where you can do somethign safer since it was just your last operation that was problematic.