如何解决在 git pull 之后,GIT 建议我先解决冲突,然后用“git rebase --continue”代替合并
在我执行 git pull upstream master
命令后,“git”建议我先解决冲突,然后是 git add file
,然后是 git rebase --continue
。但我只想做一个“简单”的合并。
这非常乏味,因为我必须在 25 次提交之前一步一步地解决我的旧冲突。但是我只想进行合并,我不想进行变基并丢失我的历史记录。
我该怎么做,git rebase --skip
或 git rebase --abort
并尝试另一个合并命令?
解决方法
看起来您的 git 配置告诉在拉取时使用 rebase
,这可以解释为什么您的 git pull
启动了 rebase
而不是 merge
。
- 要停止当前的
rebase
并使用merge
,您可以运行:
git rebase --abort # aborts the rebase,and resets to the original commit
git merge origin/mybranch # merge the remote branch
- 如果您想检查您的
pull
设置,请运行:
git config --show-origin --get pull.rebase
# if you see that the setting is global,and you want to drop it :
git config --global --unset pull.rebase
# if you want to disable it just on that local repository :
git config pull.rebase false
- 您也可以保留
pull
设置不变,并使用fetch
,后跟merge
或rebase
:
git fetch
# after inspecting the remote,run either :
git merge @{u}
# or
git rebase @{u}
# '@{u}' is a shortcut for "the upstream branch of the current branch"
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。