I have a small issue regarding git. At the beginning of the project i have clean flow (figure 1 and 2). Figure 1 is from Intellij, while figure 2 is after running gitk &
command. As expected we see same states.
But after merging "branch3" with "master", we realize that it is not good and want to delete that commit. We execute following command: git reset --hard HEAD~1
. As expected, after executing this command we are at following state:
And from that state we create new branch "branch4". Till this point everything is working as expected. But after we push "branch4" and merge it with "master" branch we receive following issue:
As you can see we still have "Commit on branch3" and "Merged in branch 3". Please advise me how can i delete those commits, as I don't want to have any record of these commits (to be similar like the first image). Because, obviously git reset --hard
does not delete remote commits. I would like to emphasize that pushing was done using following command git push --force
What command should I use instead?
P.S. With git reset --soft
I got the same.