注:Git初学者的我的经验记录,仅供参考html
1. Pull is not possible because you have unmerged files.git
症状:pull的时候app
$ git pull
ide
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'spa
应该是由于local文件冲突了orm
解决方法:htm
引用——blog
“ci
1.pull会使用git merge致使冲突,须要将冲突的文件resolve掉 git add -u, git commit以后才能成功pull.rem
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了
参考:
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