我最近开始使用一台新机器,在尝试推送到一个分支时注意到这个错误提示。这是因为之前我在GitHub上解决了一些问题并忘记了进行拉取。
所以我进行了拉取,通常情况下,在进行拉取操作时,我会得到一个文件列表,需要解决它们的更改,添加它们,然后推送。
然而今天遇到了不同的情况。我得到了这条信息:
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint: git config pull.rebase false # merge
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.
每当设置新的机器时,我以前从未见过这种情况。我在其他两台机器上使用相同的`.gitconfig`,但没有看到这条消息。
[user]
name = my name
email = my email
[format]
numbered = auto
[color]
branch = yes
diff = auto
pager = yes
status = auto
我已经做过这个很多次,但突然间我忘了。我从未在 Git 中记得见过这个提示或错误(6年来)。这是新的吗?也许我可以查看 Git 源代码的历史记录?如果不是,那么默认是什么?