1

I opened a draft pull request a while back to a repository that I don't have access to. I created the necessary branch and opened the request, and then stopped working on this issue for some time. Today, I returned to work on it and I accidentally did a "sync branch" on the development branch, which ended up merging the original repository's master into my development branch, thereby creating a new commit in the draft PR.

I tried to remove this commit by doing a hard reset followed by a force push, but this left the following message:

user force pushed 'dev-branch' from 84215ea to 97c8fd0     compare

I tried to get rid of this message by undoing the hard reset, but this resulted in the original master branch merge coming back. After that, I thought I'd try to do a "revert" on the original unwanted merge commit instead of a hard reset, but this left me with the following messages on my draft PR:

normal commit                                              97c8fd0
merge branch 'remote:master' into 'dev-branch'             84215ea
user force pushed 'dev-branch' from 84215ea to 97c8fd0     compare
revert "merge branch 'remote:master' into 'dev-branch'"    cd39f73

Now, I would like to revert the state of my draft PR to just this:

normal commit                                              97c8fd0

How can I achieve this? (if it is possible)

Thanks!

  • "but this left the following message: user force pushed 'dev-branch'" But you did force push so why is that a problem? – matt Apr 21 '23 at 22:36
  • @matt I want to know if that message can be deleted as well, which is what I was seeking originally. Plus, when I click "compare" it asks me to compare the changes made in between the time I create the branch and the current time. – Elhamer Yacine Apr 21 '23 at 23:12

1 Answers1

1

I want to know if that message can be deleted as well, which is what I was seeking originally

Not really, as illustrated in "How to permanently remove (or hide) a commit from a GitHub PR after force pushing": you would need to contact GitHub support.

However, unless that removed commit include sensitive information, there is no harm in leaving that message in the PR logs.
Just reset your branches to their desired state, force push them, and you can proceed from there.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250