I am facing issues with the git checkout command. Please help.
Here is what I did.
Lists of commands used and the error details:
git clone [my repo]
git checkout -b b01
Hereafter I made multiple changes, including creating new files and directories, committed those changes and successfully pushed the changes on that branch to the repo. like:
git push -u origin b01
Now I am done with the changes and want to merge it to the master branch. So I do a:
git checkout master
Here is the error it throws:
fatal: cannot create directory at 'workfolder': Permission denied
Git keeps me in b01, but deletes ALL the files I had created in the branch. So if I now do a
git status
it shows me:
On branch b01
Your branch is upto date with 'orgin/b01'
Changes not staged for commit:
(use "git add/rm .....)
deleted: new file1
deleted: new file2
<list of the new files I had added but which got deleted as a result of the command>
I am having to run a
git checkout -- .
to restore the files.
Please help.
I had a similar situation. Though it was due to me having the solution open in visual studio. Closing visual studio and doing a git reset put me into a good spot.
I.e. check to see if any processes are locking the folder/files.