【问题标题】:Is there a difference between "git pull --rebase" and "git fetch && git rebase --autostash FETCH_HEAD"?“git pull --rebase”和“git fetch && git rebase --autostash FETCH_HEAD”之间有区别吗?
【发布时间】:2020-08-24 16:56:01
【问题描述】:

标题说明了一切。有没有区别:

git pull --rebase --autostash

git fetch && git rebase --autostash FETCH_HEAD?

当我们这样做的时候,在:

git pull

git fetch && git merge?

谢谢!

【问题讨论】:

  • pull 命令在执行 rebase 时添加 --fork-point。它在进行合并时会稍微改变合并消息。在非常旧的 Git 版本中(早于 --autostash),还有一些额外的细微差别。

标签: git git-merge git-rebase git-pull git-fetch


【解决方案1】:

下面提到的命令

git pull --autostash

将存储您的本地更改,然后执行pull

pullfetchmerge 的组合。 fetch 不会将远程更改合并到本地分支。 所以,

git pull

类似于

git fetch && git merge

希望这可能会回答您的问题。

【讨论】:

  • "git pull --rebase 类似于git fetch && git merge" 当然不是——它类似于git fetch && git rebase
猜你喜欢
  • 2020-10-20
  • 2011-09-11
  • 2011-03-22
  • 2018-03-05
  • 2021-02-05
  • 2017-06-30
  • 2015-03-21
  • 2021-10-14
相关资源
最近更新 更多