【发布时间】:2023-01-17 01:05:17
【问题描述】:
我不小心运行了git branch <branchA> <branchB> -f,无法回到之前的状态...
结果,我收到了太多的变化......
我最初是在很久以前创建的一个分支中使用 Draw.io 编写架构的。当我认为是时候合并它时,我做不到,因为我收到以下消息。
There isn't anything to compare. master and document/initial-architecture are entirely different commit histories.
所以我查看了这个 URL (There isn't anything to compare. Nothing to compare, branches are entirely different commit histories)。
所以我运行了以下代码。
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'.
在这里,发生了 37 处更改,我想撤消它们,但我不知道该怎么做。 Git 图看起来像这样。
【问题讨论】: