关于git远落后于远程master的时候,pull提示选择不同合并策略的分析

发布时间 2023-11-07 10:59:49作者: 你看起来好像很美味
如果远落后于master分支,pull合并的时候,git会提示你选择合并策略,如下:
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
对应的三个方案:
  1. merge:最普遍的方式,拉下来解决冲突
  2. rebase:使用变基方式,不会产生无用 commit
  3. fast-forward:快进方式,只拉取没有冲突的