Git fast forward提交

來源:互聯網
上載者:User

多人協同開發,使用Git經常會看到警告資訊包含術語:fast forward, 這是何義?

簡單來說就是提交到遠程中心倉庫的代碼必須是按照時間順序的。

比如A從中心倉庫拿到代碼後,對檔案f進行了修改。然後push到中心倉庫。

B在A之前就拿到了中心倉庫的代碼,在A push成功之後也對f檔案進行了修改。這個時候B也運行push命令推送代碼。

會收到一個類似下面的資訊:

chenshu@sloop2:~/work/189/appengine$ git pushTo 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 rejectedMerge 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方法提交代碼。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.