Git Fast-forward提交
2015-12-29 11:29
295 查看
多人协同开发,使用Git经常会看到警告信息包含术语:Fast-forward, 这是何义?
简单来说就是提交到远程中心仓库的代码必须是按照时间顺序的。
比如A从中心仓库拿到代码后,对文件f进行了修改。然后push到中心仓库。
B在A之前就拿到了中心仓库的代码,在A push成功之后也对f文件进行了修改。这个时候B也运行push命令推送代码。
会收到一个类似下面的信息:
[plain] view plaincopyprint?
chenshu@sloop2:~/work/189/appengine$ git push
To ssh://csfreebird@10.112.18.189:29418/appengine.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'ssh://csfreebird@10.112.18.189:29418/appengine.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
提醒你非快进方式的更新被拒绝了,需要先从中心仓库pull到最新版本,merge后再push.
Fast forward能够保证不会强制覆盖别人的代码,确保了多人协同开发。尽量不要使用non Fast forward方法提交代码。
简单来说就是提交到远程中心仓库的代码必须是按照时间顺序的。
比如A从中心仓库拿到代码后,对文件f进行了修改。然后push到中心仓库。
B在A之前就拿到了中心仓库的代码,在A push成功之后也对f文件进行了修改。这个时候B也运行push命令推送代码。
会收到一个类似下面的信息:
[plain] view plaincopyprint?
chenshu@sloop2:~/work/189/appengine$ git push
To ssh://csfreebird@10.112.18.189:29418/appengine.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'ssh://csfreebird@10.112.18.189:29418/appengine.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
提醒你非快进方式的更新被拒绝了,需要先从中心仓库pull到最新版本,merge后再push.
Fast forward能够保证不会强制覆盖别人的代码,确保了多人协同开发。尽量不要使用non Fast forward方法提交代码。
相关文章推荐
- Functor仿函数
- Sheepdog HTTP API
- itunes connect上传截图提示无法载入文件问题
- SVN返回版本
- 减少域名DNS解析时间将网页加载速度提升新层次-DNS缓存/预读取/拆分域名
- IzPack 学习教程 第一篇
- radiobutton的文本方位及与图片间距设置
- 【bzoj3697】【坑】采药人的路径 点分治
- PostgreSQL学习手册(函数和操作符<一>)
- windows 下 qt 连接 mysql 数据库
- request.getParameterMap()获得Map中的数据
- MySQL Notes
- String.xml 中%1$s %1$d 的使用方法
- 在lua中如何remove掉table里面的数据
- win7 旗舰版下如何分离磁盘空间与合并磁盘空间
- 关于sql的执行顺序
- vs2010 'yasm' is not recognized as an internal or external command
- 任务1
- java 实现 http 文件下载
- 圆形的imagview和正在加载的dialog