Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Git Branches and Merging Branches Creating Branches

Willemijn B
Willemijn B
5,577 Points

Where to see the working directory files

In this video Jay shows how one file seems to 'disappear' when checking out to the master branch. Where would I find this overview of files in the folder when I'm using Git in my Terminal (on Mac)? Would this be visible in a code editor like Atom the same way it is in Workspaces, or should I find it somewhere else?

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hi Willemijn B

The 'working directory' you're seeing in the video isn't actually a file directory of a folder. It is the side bar of his Text Editor that is showing the file tree of the project being worked on.
If you were to just show your folder contents on the desktop or run the list in the terminal as Jamie said, you will see all the files for the project regardless of which branch you are on. The files will only disappear and re-appear in the file tree within the Editor you are using to code (e.g Atom, VS Code, Sublime, etc).

I hope this clears it up some.

:) :dizzy:

Willemijn B
Willemijn B
5,577 Points

It does, thank you! It just didn't look like any text editor I know - then again maybe I'm just too used to dark mode ;)

Hi Jason and Willemijin

I'm not sure if the way that Git functions has changed since these comments were posted but I am experiencing the exact opposite of this. Switching between branches affects the folder view in my editor and the actual folder on my system.

It would appear that the working directory is the directory on my computer, which reflects the branch I am currently working on. If I checkout another branch the folder's contents change to reflect this. All the files for the project are not available regardless of which branch you are on, I don't see how version control could work if this were the case.

All the versions of the files are there, safely hidden away somewhere in the .git directory but only the files from the current branch are visible using a file explorer or ls in the terminal.

Of course, I could be wrong about this, I had no idea what Git was a couple of days ago :-)

Jamie Reardon
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jamie Reardon
Treehouse Project Reviewer

You can run the command -ls to show the contents of a directory. Hidden files will be ignored however, you may pass the command option -a or --all to include hidden files, they begin with a ".".

Willemijn B
Willemijn B
5,577 Points

Oh yeah I understand that, thanks though! I meant the folder view, in the GUI of his MacBook. I realize my question was phrased vaguely :)