Git錯誤總結

來源:互聯網
上載者:User

標籤:錯誤   git   

1、error: failed to push some refs to ‘[email protected]:XXXX/XXXX‘
hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (e.g., ‘git pull ...‘) before pushing again.hint: See the ‘Note about fast-forwards‘ in ‘git push --help‘ for details.
#解決方案:git pull --rebase origin mastergit push origin master
2、Your local changes to the following files would be overwritten by merge
error: Your local changes to the following files would be overwritten by merge:        protected/config/main.phpPlease, commit your changes or stash them before you can merge.
#解決方案:如果希望保留生產伺服器上所做的改動,僅僅併入新配置項, 處理方法如下:git stashgit pullgit stash pop然後可以使用git diff -w +檔案名稱 來確認代碼自動合并的情況.反過來,如果希望用程式碼程式庫中的檔案完全覆蓋本地工作版本. 方法如下:git reset --hardgit pull其中git reset是針對版本,如果想針對檔案回退本地修改,使用git checkout HEAD file/to/restore
3、Pull is not possible because you have unmerged files
Pull is not possible because you have unmerged files.Please, fix them up in the work tree, and then use ‘git add/rm <file>‘as appropriate to mark resolution, or use ‘git commit -a‘.
#解決方案:查看衝突檔案1、git status也可以告訴我們衝突的檔案; Unmerged paths:  (use "git add <file>..." to mark resolution)        both modified:      file2、手動解決衝突,然後提交更改:vi filegit add filegit commit -m ‘解決衝突‘
4、CONFLICT (content):Merge conflict in readme.txt
$ git merge feature1Auto-merging readme.txtCONFLICT (content):Merge conflict in readme.txtAutomatic merge failed; fix conflicts andthen commit the result.
#解決方案:1、git status也可以告訴我們衝突的檔案;#       both modified:      readme.txt  #衝突檔案為readme.txt2、查看readme.txt的內容:<<<<<<<HEADmaster=======fenzhi>>>>>>> feature1Git用<<<<<<<,=======,>>>>>>>標記出不同分支的內容,我們修改如下後儲存:master and fenzhi3、再提交:$ git add readme.txt $ git commit -m "hebing"
5、The branch ‘feature-vulcan‘ is not fully merged.
error:The branch ‘feature-vulcan‘ is not fully merged.If you are sure you want to delete it, run ‘git branch -D feature-vulcan‘.
#解決方案:強行刪除,需要使用命令:git branch -D feature-vulcan。
6、Please move or remove them before you can merge.  Aborting
#解決方案:git clean  -d  -fx ""其中 x  -----刪除忽略檔案已經對git來說不識別的檔案d  -----刪除未被添加到git的路徑中的檔案f  -----強制運行

本文出自 “營運·人生” 部落格,請務必保留此出處http://qiangsh.blog.51cto.com/3510397/1769956

Git錯誤總結

聯繫我們

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