Note: The personal experience record of Git beginners is for reference only
1. Pull is not possible because you have unmerged files.
Symptoms: 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’
I think it’s because the local file is colliding
Solutions:
Reference –
”
1. Pull will use Git merge to cause conflicts. The conflicting files need to be resolved out of Git Add-u and git commit can only be pulled successfully.
2. If you want to abort local file changes, use Git reset –hard FETCH_HEAD. FETCH_HEAD represents the commit point formed after the last successful Git pull. Then git pull.
note:
Git merge forms a merge-head. Git push forms references like HEAD. A HEAD represents a local reference that has been formed after a recent successful push.
”
In my experience, sometimes this happens for no reason, and the Untracked files are quite many (actually I only changed one or two files), so I had to save the local changes I decided to make first, then use Git reset –hard FETCH_HEAD to go back to the point after the last successful pull, and then pull again without any problems
2.You are not currently on a branch.
Symptoms: During a pull, the “git reset –hard FETCH_HEAD” method fails.
1. Pull is not possible because you have unmerged files.
Symptoms: 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’
I think it’s because the local file is colliding
Solutions:
Reference –
”
1. Pull will use Git merge to cause conflicts. The conflicting files need to be resolved out of Git Add-u and git commit can only be pulled successfully.
2. If you want to abort local file changes, use Git reset –hard FETCH_HEAD. FETCH_HEAD represents the commit point formed after the last successful Git pull. Then git pull.
note:
Git merge forms a merge-head. Git push forms references like HEAD. A HEAD represents a local reference that has been formed after a recent successful push.
”
In my experience, sometimes this happens for no reason, and the Untracked files are quite many (actually I only changed one or two files), so I had to save the local changes I decided to make first, then use Git reset –hard FETCH_HEAD to go back to the point after the last successful pull, and then pull again without any problems
2.You are not currently on a branch.
Symptoms: During a pull, the “git reset –hard FETCH_HEAD” method fails.
$ 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.
Solutions:
First git checkout-B temp
Second, Git Checkout Master
You can restore the master Repository state and then pull
Original: https://blog.51cto.com/halolk/1304701
Read More:
- Git pull error: pull is not possible because you have unmerged files
- Pull is not possible because you have unmerged files
- Error: You have not concluded your merge (MERGE_HEAD exists)
- Git pull undo misoperation
- How to Fix GIT Push Error
- Git failed to submit data error: failed to push some refs to’https://github.com/XXXXXXX/gif.git’
- Git solves pull origin error: the following untracked working tree files would be rewritten by merge
- You have not concluded your merge (MERGE_HEAD exists)
- git push error failed to push some refs to solution
- Error: failed to push some refs to ‘xxx’
- pathspec ‘master’ did not match any files known to git
- [FAQ] after git merge, the push to Gerrit fails, indicating no new changes?
- You need to resolve your current index first
- [Git & GitHub] Solution: error: failed to push some refs to’https://github.com/xxxx.git’
- [Git] git pull pull remote git push to remote git commit submit reject
- Please specify which branch you want to merge with
- [Solved] ERROR: commit 60acc70: missing Change-Id in message footer
- How to cancel the commit, how to cancel the commit after git commit, and how to change the submitted content
- Git push you are not allowed to upload merges