如果本地存在分支,我应该在拉取之前执行 git 获取吗?

Should I do git fetch before pull if branch exists locally?

我有以下关于 git 的问题。

我是新手git。我想在本地获取 branch1 的最后状态。

现在我打开 branch2 并且 branch1 存在于本地。

现在我做

  1. 获取
  2. 切换到分支 1

请澄清第一个 fetch 是否多余?

这是多余的。引用 the docs:

More precisely, git pull runs git fetch with the given parameters and calls git merge to merge the retrieved branch heads into the current branch.