注:Git初學(xué)者的個人經(jīng)驗記錄,僅供參考

1. Pull is not possible because you have unmerged files.
癥狀:pull的時候
$ git pull
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'
應(yīng)該是因為local文件沖突了
解決方法:
引用——
“
1.pull會使用git merge導(dǎo)致沖突,需要將沖突的文件resolve掉 git add -u, git commit之后才能成功pull.
2.如果想放棄本地的文件修改,可以使用git reset --hard FETCH_HEAD,F(xiàn)ETCH_HEAD表示上一次成功git pull之后形成的commit點。然后git pull.
注意:
git merge會形成MERGE-HEAD(FETCH-HEAD) 。git push會形成HEAD這樣的引用。HEAD代表本地最近成功push后形成的引用。
”
就我的經(jīng)驗,有時候會莫名其妙地出現(xiàn)這種狀況,而且Untracked files 還特別多(實際上自己可能只改了一兩個文件),所以只好先保存好自己確定做出的local的修改,然后用git reset --hard FETCH_HEAD回到上次成功pull之后的點,然后再pull就沒有問題了
2.You are not currently on a branch.
癥狀:有一次pull的時候又出現(xiàn)沖突,這回用“git reset --hard FETCH_HEAD”方法都不行了,出現(xiàn):
$ git pull You are not currently on a branch, so I cannot use any 'branch.<branchname>.merge' in your configuration file. Please specify which remote branch you want to use on the command line and try again (e.g. 'git pull <repository> <refspec>'). See git-pull(1) for details.
解決方法:
首先git checkout -b temp
其次git checkout master
即可恢復(fù)到master repository的狀態(tài),然后就可以pull了
參考:
http://skywhsq1987.iteye.com/blog/1814137
http://slacy.com/blog/2011/04/git-pull-says-you-are-not-currently-on-a-branch/
http://ddmytrenko.blogspot.com/2012/03/git-not-currently-on-any-branch.html
分享文章:Git一些錯誤的解決方法-創(chuàng)新互聯(lián)
瀏覽地址:http://chinadenli.net/article40/hpiho.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈、App開發(fā)、關(guān)鍵詞優(yōu)化、商城網(wǎng)站、響應(yīng)式網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容