【Git】---git fetch命令

语法

git fetch [<options>] [<repository> [<refspec>…​]]
git fetch [<options>] <group>
git fetch --multiple [<options>] [(<repository> | <group>)…​]
git fetch --all [<options>]

描述

官方描述:从另一个仓库中下载对象和引用。

笔者解读:当需要将远程仓库中的更新取回本地时,使用 git fetch 命令。

参数

<repository>

The "remote" repository that is the source of a fetch or pull operation. 即远程仓库的名字。

<refspec>…

Specifies which refs to fetch and which local refs to update.  格式为 <src>:<dst>,即指明远程分支和本地分支的名字。

例子

1.取回远程跟踪分支的更新

$ git fetch origin

省略了 refspec 参数,作用是从 远程仓库origin 中将所有分支的更新取回本地。如果未指定远程仓库名称,默认使用 origin 。

2.取回特定分支的更新

$ git fetch origin master:master

将远程仓库origin中分支master的跟新取回到本地分支master中。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值