1. 程式人生 > >Git 一些錯誤的解決方法

Git 一些錯誤的解決方法

Git初學者的個人經驗記錄,僅供參考

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'

應該是因為local檔案衝突了

解決方法:

引用――

1.pull會使用git merge導致衝突,需要將衝突的檔案resolve掉 git add -u, git commit之後才能成功pull.

2.如果想放棄本地的檔案修改,可以使用git reset --hard FETCH_HEAD,FETCH_HEAD表示上一次成功git pull之後形成的commit點。然後git pull.
注意:

git merge會形成MERGE-HEAD(FETCH-HEAD) 。git push會形成HEAD這樣的引用。HEAD代表本地最近成功push後形成的引用。

就我的經驗,有時候會莫名其妙地出現這種狀況,而且Untracked files 還特別多(實際上自己可能只改了一兩個檔案),所以只好先儲存好自己確定做出的local的修改,然後用git reset --hard FETCH_HEAD回到上次成功pull之後的點,然後再pull就沒有問題了

2.You are not currently on a branch.

症狀:有一次pull的時候又出現衝突,這回用“git reset --hard FETCH_HEAD”方法都不行了,出現:

$ 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

即可恢復到master repository的狀態,然後就可以pull了

相關推薦

手勢識別中一些錯誤解決方法

最近在看一個手勢識別的專案時,遇到了一些錯誤,主要原因是該專案是使用python2.7+opencv2.4.8,而我的環境是python3.5.2+opencv3.1.0, 於是將一些解決方法記錄下來,希望能夠幫助其他人少走些彎路。 1.       背景分離函式

Git常見錯誤解決方法

1.fatal: Couldn't find remote ref master或者fatal: 'origin' does not appear to be a git repository以及fatal:Could not read from remote repos

Eclipse SVN的一些錯誤解決方法

  一、org.tigris.subversion.javahl.ClientException: Attempted to lock an already-locked dir異常解決方法 myeclipse用svn提交的時候報錯:  Attempted to lock

solr 4.3的一些錯誤解決方法

在去年時候學習使用了solr4.0,現在solr版本最新已經到了4.3了,前兩天因為工作需要在一臺伺服器上面新安裝solr,但是生產環境是4.0,不過想到是內部測試用的,且主要功能就是寫入,刪除,搜尋,與程式上面沒有太多的深入開發,於是還是安裝了最新的4.3版本 解壓安裝啟動後,就可以了;這時需要新增col

Git 一些錯誤解決方法

Git初學者的個人經驗記錄,僅供參考 1. Pull is not possible because you have unmerged files. 症狀:pull的時候 $ git pull Pull is not possible because you have

Git與遠程倉庫關聯以及關聯錯誤解決方法

class 創建 rap 技術 get 假設 nta att width 假設你github的用戶名是 helloworld ,你在上面創建了一個 名為 hello 的 repository. 一. 與本地倉庫進行關聯 1.1用原生ssh進行關聯,速度快: git r

git fatal: The remote end hung up unexpectedly錯誤解決方法

在使用git更新或提交專案時候出現 "fatal: The remote end hung up unexpectedl

bash: ./make_ext4fs: No such file or directory 錯誤解決方法

nodes tor for locks exec ++ 能夠 ipp option 一般出現該錯誤是因為應用程序是32位導致的,能夠使用file命令來查看: [email protected]/* */:~/Desktop$ file make_ext4fs

vsftpd的530 Login incorrect錯誤解決方法 vsftpd登錄錯誤

user clas log 現在 nco article oca 服務 有時 530 Login incorrect只有用匿名anonymous才可登錄,其余所有用戶都報530 Login incorrect錯 復制代碼 代碼如下: local_enable=YESwrit

ubuntu 使用sudo apt-get update 出現 被配置多次導致無法升級錯誤解決方法

code 開發機 goup 使用 lin logs 配置 周末 ubun 這個周六周末在考慮升級自己GPU開發機,在琢磨使用docker來按轉tensorflow環境,在升級軟件的時候爆出了如下錯誤 在 /etc/apt/sources.list.d/sogoupin

Error, some other host already uses address 192.168.0.202錯誤解決方法

機器 虛擬機網卡 一個 already 局域網 使用 sysconf erro 錯誤 Error, some other host already uses address 192.168.0.202錯誤解決方法 今天配置虛擬機網卡的時候遇到錯誤:Error, so

報錯from 子句語法錯誤 解決方法

nbsp -1 alt http 1-1 解決 語法 ges cnblogs 解決方法: 報錯from 子句語法錯誤 解決方法

android studio 更新 Gradle錯誤解決方法(Gradle sync failed)

app 是我 clear 聯網 建議 span 內容 roi file android studio 更新 Gradle錯誤解決方法 Android Studio每次更新版本都會更新Gradle這個插件,但由於長城的問題每次更新都是失敗,又是停止在Refre

國網SG-UAP 開發平臺 RestExceptionResolver 錯誤解決方法

spa int 服務 logic work 格式 開發平臺 ati and 報錯原信息: SG-UAP :ERROR RestExceptionResolver:141 - java.lang.StringIndexOutOfBoundsException: String

Apache 403 錯誤解決方法-讓別人可以訪問你的服務器

denied 標簽 ted art get 錯誤 cnblogs -1 註意 參考網址:http://www.cnblogs.com/mrlaker/archive/2013/04/29/3050888.html http://www.jb

yum 下載時出現錯誤解決方法

yum1,ping www.baidu.com 驗證你是否能夠上網2,ping 223.5.5.5 ping域名不通,ping外網地址時通了,你的DNS配置有問題。3,修改DNS網卡的配置文件 如: cp /etc/sysconfig/network-scripts/ifcfg-eth0 /t

安裝Matlab出現Error 1935錯誤解決方法

技術 啟動 運行 十進制 gist log ror oca 下拉菜單 1、開始 - 運行(輸入regedit.exe)- 確定或者回車,打開註冊表編輯器; 2、在打開的註冊表編輯器中找到:HKEY_LOCAL_MACHINE ,並展開:HKEY_LOCAL_MACHINE

Visual Studio 2015 Update 1 安裝到最後 KB3022398 錯誤解決方法

content cal style 程序 修復 sof microsoft data key 最後一步遇到一個錯誤的確讓人心寒 只是我們還是得一步步解決。別去卸載重裝。太費時 首先打開 regedit 註冊表,依次進入: 1:HKEY_LOCA

RHEL6關於Header V3 DSA signature: NOKEY, key ID錯誤解決方法

rhel6 tigervnc war vnc led key tiger 安裝 資料 通過yum命令在安裝軟件時的時候,提示如下錯誤: warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID f

Target runtime Apache Tomcat v6.0 is not defined.錯誤解決方法

view js xml val fix for .text each 工程 eclipse 我們在用Eclipse導入一個新的項目時,假設我們使用JDK1.7和tomcat7時,導入的項目會在Eclipse的Marker下提示Target runtime