I was working on a single file in a branch (Branch-A), committed my code and pushed up my changes. I then checked out a new branch (Branch-B) did some work but noticed I was getting changes on the same file I worked on in Branch-A.
I ran git checkout -- /file.php
to revert the changes, but got the message:
error: unable to unlink old 'file.php' (Permission denied)
Googling the issue, I find a lot of StackOverflow answers saying to change the file's permissions, which I tried:
chmod ug+w file.php
and
chmod 777 file.php
But still I get the same issue with the same error message.
Would anyone know what this is or what I could do next?