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

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,148 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.