Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't do a git pull

Tags:

git

I'm trying to do a git pull and get the error message:

error: The following untracked working tree files would be overwritten by merge: <myFileName> Please move or remove them before you can merge. 

So, I try to remove the file using the command git rm --cache which results in the error:

fatal: pathspec <myFileName> did not match any files 

At this point I'm stuck. I can't pull until I remove the file. But, it tells me I can't remove the file.

What can I do to fix this?

like image 658
Todd Avatar asked May 08 '13 18:05

Todd


People also ask

Why my git pull is not working?

This might be happening because of some conflict files present in your repository . And you was still trying to check in files . So After that what happen , it will check in your local repository not in master repository . So u was not able to pull or check in anythings in master(head) repository .

Why is git pull not pulling latest commit?

One explanation would be that the latest commits have been done on another branch, as explained in "Git pull from my public repository not working". The other possibility is for you to be in a detached HEAD mode. That would make any git pull "up-to-date" since you are in any branch.

How do you fix pulling is not possible because you have unmerged files?

Why does git say "Pull is not possible because you have unmerged files" , and how can I resolve it? You simply needed to add "$ git add <file>"...to update what will be committed or restore (to discard changes in working directory) then commit "$ git commit ", then "$git push" to conclude merge.


1 Answers

This is an opportunity for the 'git clean' command. If you don't care about the untracked files ... git clean -n to see what will be removed, and git clean -f to go ahead and rm untracked files.

Add -d to the commands to also operate on directories:

  git clean -dn   git clean -df 
like image 189
troyfolger Avatar answered Sep 17 '22 16:09

troyfolger