My scenario is like this:
A->B->C->D
A was the original version of code I received(it had commits before it, but not mentioning it here).
In B, I applied code formatting which introduced hundreds of whitespace changes. Hence the person reviewing the code found over thousands of changes due to it. While I know that adding ?w=1 parameter to the commit url on github allows code diffs without whitespaces, the reviewer is not accepting that and tells me to simply revert to previous formatting. I think the only way to deal with this scenario is to simply delete C and D from history(locally and remotely) and then make the changes again.
I tried git revert but that seems to temporarily delete changes in remote. After next git push, it pushes the commits AGAIN.
Please suggest proper steps so that C,D totally gets deleted from history both locally and remotely as if they were never there(thereby rewriting history).
Note:
I am on MASTER branch and my local repo is totally in sync with remote.
EDIT:
I have ALREADY TRIED that accepted answer in link. Here is what I did:
git reset --hard HEAD~2
Then I did git push origin HEAD --force
But I get this command:
error: unable to push to unqualified destination: HEAD
And if i put master
instead of HEAD, i get "everything up to date".
I am pushing to master and I have just one working branch at this moment.