I accidentally run git branch <branchA> <branchB> -f
and can't go back to previous state...
As a result of that, I received too many changes...
I originally wrote the architecture using Draw.io in a branch I created a long time ago. When I thought it was time to merge it, I couldn't do it because I got the following message.
There isn't anything to compare. master and document/initial-architecture are entirely different commit histories.
So I looked at this URL (There isn't anything to compare. Nothing to compare, branches are entirely different commit histories).
So I ran the following code.
81906@DESKTOP-608QNA0 MINGW64 ~/Documents/slackbot-gpt3 (document/initial-architecture)
$ git branch master document/initial-architecture -f
81906@DESKTOP-608QNA0 MINGW64 ~/Documents/slackbot-gpt3 (document/initial-architecture)
$ git checkout master
Switched to branch 'master
Your branch and 'origin/master' have diverged,
and have 25 and 28 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
81906@DESKTOP-608QNA0 MINGW64 ~/Documents/slackbot-gpt3 (master)
$ git push origin master -f
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: Cannot force-push to this protected branch
To https://github.com/Suchica/slackgpt3.git
! [remote rejected] master -> master (protected branch hook declined)
error: failed to push some refs to 'https://github.com/Suchica/slackgpt3.git'.
Here, 37 changes have occurred, and I want to undo them, but I'm having trouble figuring out how to do it. The Git graph looks like this.
And here is the result of git reflog
.