Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

General Discussion Adding Changes to a Project on GitHub

How does Github detect the copyright edit that Dave makes on his text editor?

Hey everyone,

I might've missed something here - but when Dave switches to his text editor at the 33 second mark, and adds the copyright to his code, how does Github automatically detect this and record the changes on GitHub Desktop?

Thanks in advance -

2 Answers

Kevin Korte
Kevin Korte
28,109 Points

That's what git does, it's constantly watching for changes. It knows the status of all of the files as of the last commit, and as it sees changes happen it real time, it will update the desktop app. Running git status in the console will show you the same results as they happen.

Thanks Kevin,

So just to be clear - once you upload your code onto Github Desktop, it automatically finds this code within your hard drive?

Do you not at any point have to click an option to link this?

Also, what exactly do you mean by 'running git status in the console'? This might've been totally off - but I tried typing 'git status' in the Safari console but got a SyntaxError.

Kevin Korte
Kevin Korte
28,109 Points

I also do not use Github Desktop, but as I understand it, it's just a simple graphic user interface for git. My guess, is when you start a new project, and have it in Github desktop, it will using the .git folder to track changes. By default this folder is probably hidden from your view, as must times any folder that starts with a dot is hidden, but there are ways to show hidden folders on your operating system.

How git actually tracks, I do not know. People smarter than me figured that out, but I do know git knows and any time what has changed since your last commit, and so it's not unfeasable that github desktop is updating as the git folder does.

It should only find code to the root folder is was initialized to. It's not going to look at your whole hard drive. But wherever you set up project, there would be a .git folder there, that and than everything "downstream" in the folder structure from that root folder would be tracked by git by default.

And on the console, I may have jumped ahead. I use, and many do, use git in the console or terminal. I don't use, but once a long long time ago, github desktop.

You can interact with git in your console, when you are in the root projects folder where git was initialized, (where the .git folder is), you can run a lot of different git commands, git status is one of them I use a lot, which will tell you in the console, what files have changed, what files are tracked, and what files are untracked. If that's not very clear, keep doing the git courses here, and you will eventually get to where you use git in the command line or terminal.

I haven't used the GitHub desktop software in a while, but if I remember right, I think you can see changes if you have the GitHub desktop program open and are inside this program so not from your Safari browser. You will need to push up your code changes if you want them added to your online GitHub repo. Otherwise, they will only be saved on your computer.

Kevin mentions the console which is how I access GitHub. You need to be inside Terminal for macs, not sure what it is for PC. It's the command prompt area where you use UNIX commands to navigate around to your projects. If you are only using GitHub via the desktop friendly version, you won't see this. There is a whole other way to use git where you just type commands directly and push/pull code to/from GitHub via the console.