我在develop分支工作。我提交了我的代码并切换到另一个分支feature/2.10.9。我不得不从 中获取最新的feature/2.10.9,但我错误地运行了以下命令
git pull origin develop
Run Code Online (Sandbox Code Playgroud)
代替
git pull origin feature/2.10.9
Run Code Online (Sandbox Code Playgroud)
从开发分支中提取最新代码。并且 git status 显示以下输出:
On branch feature/2.10.9
Your branch is ahead of 'origin/feature/2.10.9' by 5 commits.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud)
但我不想将develop分支更改推送到那个feature/2.10.9. 我应该怎么做才能中止当前的推送。
谢谢
您基本上需要撤消通过运行git pull origin develop而不是git pull origin feature/2.10.9.
首先在本地执行
git reflog获取SHA-1错误拉取之前的提交(最后一个稳定状态)。
要撤消合并 -
git reset --hard <SHA-1 of commit obtained above>
Run Code Online (Sandbox Code Playgroud)
请注意,所有这些都应该在您在分支机构时完成feature/2.10.9。完成这些步骤后,您将处于与错误合并之前相同的状态。现在您可以安全地运行git pull origin feature/2.10.9它将从远程获取并合并最新的 feature/2.10.9
| 归档时间: |
|
| 查看次数: |
2319 次 |
| 最近记录: |