Question

What environment is this tutorial taking place?

Posted September 4, 2017 1.1k views
Git

I’m curious as to how the author of this git tutorial: https://www.digitalocean.com/community/tutorials/how-to-use-git-branches

is able to have git hide/reveal files in the local system using branching. In my mac when I try to do this, it is still visible in the file system. no matter what branch I’m currently on. At first I thought this was only possible in the remote server of git, but realized they had to push the changes. How can I accomplish this in my mac?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Branching definitely works locally. New files need to be staged before git can associate them with a specific branch. So if you create a new branch and then create new files, you need to run git add and git commit. Then, when you switch to a different branch, your filesystem should reflect the new branch’s state (the one that you switched to) and remove the new files that were created earlier. The same would be true for files that were modified or deleted.

Do you see this issue with files that have been staged? Keep in mind that when you create a new branch, it is based on the current branch by default so you won’t see any immediate changes unless you make any.

Submit an Answer