git - 如何解决git中的分歧?
问题描述
我在解决我的工作副本上遇到的问题时遇到了麻烦:早些时候我拉动并自动合并了几个文件,然后它们出现在我没有提交的暂存区域中。我现在恢复了文件中的更改,git checkout -- my/file
当天晚些时候,我想再拉一次,但它不能,我收到如下错误:
$ git pull
error: You have not concluded your merge (MERGE_HEAD exists).
hint: Please, commit your changes before merging.
fatal: Exiting because of unfinished merge.
我该如何解决这种情况?我不想在这个分支上提交任何东西!我也得到:
$ git status
On branch dev
Your branch and 'origin/dev' have diverged,
and have 3 and 4 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)
Untracked files:
(use "git add <file>..." to include in what will be committed)
解决方案
首先,git merge --quit
(Git 2.23+)应该有助于摆脱正在进行的合并。
其次,git pull --rebase
应该有助于在更新的origin/dev
.
然后就可以推了。
OP BitFreak使其工作(见评论):
git push --abort
git pull --rebase
推荐阅读
- .net-core - 升级到 2.1 后,dotnet 核心 cpu 利用率发生了巨大变化
- objective-c - Swift 4 中的 NSMenu 子类化
- scala - 用于安装 scala 插件的 URL 损坏
- ios - 适用于 iOS 的 Firebase Crashlytics:关闭非符号化问题
- c# - 实体框架 - 按实体或表进行通用审计
- javascript - Jquery .each() .click() 只获取最后一个元素中的数据
- python - Matplotlib boxplot:conf_intervals 长度与 x 不兼容
- mysql - 在无脂肪框架中运行准备好的语句
- php - mysql join where for 1 table
- java - 如果抛出运行时异常,Hibernate 不会回滚