I did several git reverts and pushed to remote branch(meaning revert a commit and then revert revert...), which looks pretty annoying. I want to clean my local and remote log history to get rid of these revert logs. For example, when I want to keep the commits but remove log history for the last 4 revert commits, would it work to do git rebase -i HEAD~4 and selected fixup/squash for my local? If yes, would it work to then run git push -force so that the log history in remote syncs with my local and thus gets the last 4 log message cleaned?
git reset HEAD~4
git stash
git push --force-with-lease
git stash pop
git add --all & git commit
Make sure your changes are not going to affect others!!!