What environment is this tutorial taking place?

September 4, 2017 96 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?

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.

Have another answer? Share your knowledge.