I have a branch called "develop" in remote bare repo "hub" and I have a checkout copy of the develop branch in my local git repository (user poomalai). I have deleted (git rm --cached) a file (Mydirectory/myfile.php) from another checkout copy (user raj) and pushed to the hub repository.
Now when I pull the changes from the hub to "poomalai" it worked fine and I got the commit message of file deletion in the git log. I have added the file in the .gitignore file in the user poomalai. Now I have created the file in my local repo (user poomalai).
Now the file is no more in the version control and changes to the file is not tracked by git.
But when I try to switch the branch to some other, it says the following
error: The following untracked working tree files would be overwritten by checkout: Mydirectory/myfile.php Please move or remove them before you can switch branches. Aborting When I remove the file using linux rm command, I am able to switch branches. If I create the file again, it again throws the same error. I need the file to be in the directory but it should not be tracked by git.
I tried following commands:
git rm ----> says fatal: pathspec 'diamonds_webservice/dbconnect.php' did not match any files git gc git reset --hard HEAD git pull Nothing works. Please someone help me