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 (user poomalai
), it works fine, and I have the commit message 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 longer in the version control, and changes to the file is not tracked by git.
But when I try to switch to some other branch 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
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
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…