Can't open file in working respository

$ git status

On branch mycode

nothing to commit, working tree clean

$ git checkout -b mycode

fatal: A branch named 'mycode' already exists.

$ git fetch

$ intro-python/git-basics/change_me.txt

-bash: intro-python/git-basics/change_me.txt: Permission denied

$ git status

On branch mycode

nothing to commit, working tree clean

If you are already on the branch named “mycode”, then you can not checkout another branch of the same name. What exactly are you trying to do?

lol, sorry. I have no idea. This is my first day with git. My computer rebooted. I went back to the intro guide I was following. I changed the file with vi. Did a git diff and nothing came up. Tried to do a git commit and that is what I got.

Surely you can explain what you are hoping to accomplish here. So you have a file named change_me.txt in the git repository? If so, you should be able to edit it, save it, and the git diff to see the changes you have made.

Can you show us a screenshot of your folder structure that shows all the folders/files in the repository?

I was confused on what it meant to be in the working tree. I thought I had to check out the file after I logged in. I downloaded Atom and then opened it in there, and then I could see what was going on. The original changes I had made prior to the reboot did not save. I thought that the intro-python/git-basics/change_me.txt would allow me to check out the file. I didn’t have to check out the file, because you said I’m already in the directory. I had to use text editor to actually edit the file and then I could make changes, add and commit. Basically I didn’t understand the fundamental principle of how this is working with the checkout.

You do not check out files to work on them. You checkout a branch to work on the files in that branch.

1 Like