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 Basics Workflows A Day in the Life of a Git Project

In this video it looks you go directly to an earlier commit to fix a bug.

How does that work? You could change the commit but that won't change future commits that rely on buggy code. What's going on in that part of the video?

1 Answer

That's how it looks, but in reality he may have debugged the code that is running in production (HEAD of the master branch) and identified the problem code. He then probably tracked down where that code came from which he shows us was added as part of one of his earlier commits. To fix this code, he wouldn't change the existing commit. As you say, that would mess up code history. Instead, he would probably checkout the master branch in his local forked repo and make his required change, then commit it and push it to his remote repo (the fork of the origin repo that contains the code that runs the treehouse website). Now he can make a pull request asking for his change to be merged into the main treehouse repo to fix the problem. After it is merged, someone would have to deploy the code to the website server and update the website.