Git cached option

This week I was working on a project for a client. The client wanted me to set up a repo on GitHub with separate folders for frontend and backend files. I set up my local repo like that and created a new remote repo on GitHub.

However, when I pushed up an initial commit and checked the GitHub repo, the files in the frontend folder were inaccessible to me. Of course, I immediately went to Google and got plenty of hits on the problem.

After trying a couple of proposed fixes without success, I found the solution:

git rm --cached /frontend

At the time, I had never used the --cached option. You use it when you want to remove a file (or an entire folder in my case) from the Git staging area and into a commit prior to being pushed.

I still don’t know exactly how failed to push the files in the frontend folder to the GitHub repo on my initial commit, but I have a ways to go when it comes to git mastery. In fact, to build my skills and confidence with it, I plan to spend a whole month immersing myself in git early in 2020.

Show Comments

Get the latest posts delivered right to your inbox.