赞
踩
git 拉取命令(pull)的标准格式是:
$ git pull <远程主机名> <远程分支名>:<本地分支名>
一般我们简写成
$ git pull
代表从远程分支拉取到当前的本地分支。
有的时候,已经知道远程分支与本地分支有不同的commit,比如本地分支有一个临时的commit,远程分支并没有。是不能简单执行git pull
的,会报错。
此时如果只是想放弃本地的临时提交,强制将远程仓库的代码覆盖到本地分支。就要用到--force
参数,强制拉取功能
git manual中关于--force
参数的说明
命令格式如下:
$ git pull --force <远程主机名> <远程分支名>:<本地分支名>
示例:
$ git pull --force origin master:master
From https://gitee.com/l0km/myprj
+ e072b6b...d5a5684 master -> master (forced update)/** 强制更新 */
warning: fetch updated the current branch head.
fast-forwarding your working tree from
commit e072b6bf59ab4d371b24966005b6d2b40e30bbw5.
Already up-to-date.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。