github上的版本和本地版本衝突的解決方案

來源:互聯網
上載者:User

標籤:git push   cte   版本   about   for   nbsp   you   branch   bec   

情景:

在github上建立項目,然後本地git init

然後沒有git pull -f --all

然後git add .  | git commit -am "init"

導致github上的版本裡有readme檔案和本地版本衝突,下面給出衝突原因:

 

[master][~/Downloads/ios] git push -u origin master

 

Username for ‘https://github.com‘: shiren1118
Password for ‘https://[email protected]‘: 
To https://github.com/shiren1118/iOS_code_agile.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to ‘https://github.com/shiren1118/iOS_code_agile.git‘
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. ‘git pull‘)
hint: before pushing again.
hint: See the ‘Note about fast-forwards‘ in ‘git push --help‘ for details.

查看大部分資料,只有這個有用

http://www.cnblogs.com/xwdreamer/archive/2012/05/29/2523958.html

勾選強制覆蓋已有的分支(可能會丟失改動),再點擊上傳,上傳成功。

 

只有這句是核心,所以,本人就略微想了一下

[master][~/Downloads/ios] git push -u origin master -f 

 

至此,搞定問題

 

github上的版本和本地版本衝突的解決方案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.