zoukankan      html  css  js  c++  java
  • Git Fast-forward提交

    多人协同开发,使用Git经常会看到警告信息包含术语:Fast-forward, 这是何义?

    简单来说就是提交到远程中心仓库的代码必须是按照时间顺序的。

    比如A从中心仓库拿到代码后,对文件f进行了修改。然后push到中心仓库。

    B在A之前就拿到了中心仓库的代码,在A push成功之后也对f文件进行了修改。这个时候B也运行push命令推送代码。

    会收到一个类似下面的信息:

    [plain] view plaincopyprint?
     
    1. chenshu@sloop2:~/work/189/appengine$ git push  
    2. To ssh://csfreebird@10.112.18.189:29418/appengine.git  
    3.  ! [rejected]        master -> master (non-fast-forward)  
    4. error: failed to push some refs to 'ssh://csfreebird@10.112.18.189:29418/appengine.git'  
    5. To prevent you from losing history, non-fast-forward updates were rejected  
    6. Merge the remote changes (e.g. 'git pull') before pushing again.  See the  
    7. 'Note about fast-forwards' section of 'git push --help' for details.  


    提醒你非快进方式的更新被拒绝了,需要先从中心仓库pull到最新版本,merge后再push. 

    Fast forward能够保证不会强制覆盖别人的代码,确保了多人协同开发。尽量不要使用non Fast forward方法提交代码。

  • 相关阅读:
    SpringBoot exception异常处理机制源码解析
    集群时间同步
    VMware 克隆的相关设置
    MySQL安装
    MogliFS与spring mvc结合简单示例
    MogileFS与spring结合
    MogileFS表说明
    使用Maven编译项目遇到——“maven编码gbk的不可映射字符”解决办法
    IAT HOOK 简单实现
    进程加载_模块隐藏
  • 原文地址:https://www.cnblogs.com/ShaYeBlog/p/5085124.html
Copyright © 2011-2022 走看看