[英]I Accidentally Pulled Master branch Of Repo1 Into local and changed Remote to Repo2 and pushed to specific Branch. How to Revert This?
I Had to -我不得不 -
I Did -我做了-
I don't care if my code loses, I just Want to Re-do This Process without any branch conflicts我不在乎我的代码是否丢失,我只想在没有任何分支冲突的情况下重新执行此过程
Perform these steps执行这些步骤
git log // then copy the commit id at which the state of your branch is
correct
.git 日志 // 然后复制提交 id,您的分支的 state 是
correct
的。git reset --hard commitId
git 重置 --hard commitId
git push -f
git 推-f
In case you don't want to lose the code:如果您不想丢失代码:
git log // then copy the commit id at which the state of your branch is
correct
.git 日志 // 然后复制提交 id,您的分支的 state 是
correct
的。git reset --soft commitId
git 重置 --soft commitId
git reset.
git 复位。
- git stash //saving the work
git stash //保存工作
- git reset --hard //Erase everything
git reset --hard //擦除所有内容
- git push -f
git 推-f
Now clone the correct repository and apply: git stash pop
//this will bring in the changes on the intended repository现在克隆正确的存储库并应用:
git stash pop
//这将在预期的存储库中引入更改
solve if there are any merge conflicts.解决是否存在任何合并冲突。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.