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 Online Registration Form

Camille Foor
Camille Foor
6,956 Points

Updating a file on GitHub

In the GitHub tutorial, it looks like we can make updates to files and have them synced with the already existing GitHub file. I can't seem to figure out how to do that without downloading a new workspace file and creating a new repository. I know there's got to be a faster, easier way.

1 Answer

Kevin Korte
Kevin Korte
28,111 Points

It's pretty easy once you get the flow down, with git, whether the file is new and untracked, or tracked and modified, when you make a change, you have to add the file to the pending commit. There are a few ways to add files, and depending on your version of git, they do the same thing, with slight differences, but the two most common that I'm aware of are git add . and git add -A. Once you have as many files as you wanted for this commit add to be staged for commit (you can confirm what git is ready to commit by git status), you simply git commit -m "Add your commit message here". Now your local git repo is updated. To get the changes up to github, you finish with git push, or git push origin <branchname> where branchname would just be what it sounds like, the name of the branch. That could be master, or it could be a feature branch your working on. Just depends on how you have it organized.