Skip to content

获取

一句话解释

获取 downloads 提交 and 更新从 remote 不使用合并它们到 你的工作分支 — 它是 safe, 读取-仅 sync.

用大白话说

git fetch downloads 新提交, 分支, and 标签从 remote 仓库但 做 NOT 修改你的工作 directory or 局部分支. 它仅 更新你的 remote-tracking 分支 (如 origin/main).

Think of fetch as "检查什么是新 on 服务器." After fetching, you can inspect the remote changes with git log 原点/主要 or git diff 主要 原点/主要 before deciding to merge them. This makes fetch safer than pull — you stay in control.

git 拉取 is actually git 获取 followed by git 合并. If you want to see what changed before integrating it, use fetch first. Many developers fetch at the start of each work session to stay aware of remote changes.

示例

bash
# Download remote changes without merging
git fetch origin

# See what is new on the remote
git log main..origin/main

# Then merge when ready
git merge origin/main

获取 downloads 但做 不合并. 你 inspect and 合并 manually.

常见混淆

  • 容易混淆的对象: 拉取

    关键区别: 获取仅 downloads remote 数据; 拉取 downloads AND 合并到 你的 current 分支. 获取是 safe (否 file 更改); 拉取修改你的 files.

相关术语

相关资源

相关课程

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表