By JonathanF002
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?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.