Tag Archives: Git with SVN

Pull is not possible because you have unmerged files. Please, fix them up in the work tree, and then

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.

$ 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