git reset head force push

C++
git reset --soft HEAD~3 &&
git commit
git push —force-with-lease origin
Source

Also in C++: