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

Question about bug fix in video.

When the bug is found, the video makes it look like the fix is being applied to a commit that happened before Tommy created his branch. In reality, is the fix being applied to the latest commit on the master branch? (the HEAD, right?). If this isn't the case, wouldn't Tommy's branch and all subsequent branches have the bug in them also? When do those get fixed? When they try to merge, would there be a merge conflict?

Sorry for so many questions. This series is really clear on how Git works, but without experience some of these concepts are still over my head. Thanks!

Joshua Erskine
Joshua Erskine
7,706 Points

I had the same question.

Michael Anderson
Michael Anderson
3,971 Points

Sorry to revive an old thread - I have the same/similar question. Does the master branch (with the bug fix) need to be merged into his new feature branch prior to his continuing work on the new feature branch?

2 Answers

Steve Kinder
Steve Kinder
9,231 Points

This was also my question

I'm assuming that when the functionality of new branch is complete and merged into the master, there will be a conflict (the bug fix on master) which needs to be resolved. I guess here the importance of adding good comments to commits and codes ensures that the bug is also fixed at this point of merge.

I'm not sure there would be any other way

Jeremy Castanza
Jeremy Castanza
12,081 Points

There's two thoughts for this.

1) This is really where the need for pulls come into play.

If you pull from master before pushing or merging, you're able to pick up these changes.

2) There's more than one way to sequence in Git. It's not really discussed here since it's possibly destructive to the project and it's also more intermediate material - it's called Rebasing. Ultimately, to answer your question, it would depend upon how the developer integrated their commit for the bug with the project. Git offers a few different ways to consolidate changes in a project.

Here's some more information on Rebasing that may give some more insight into your question: https://www.atlassian.com/git/tutorials/merging-vs-rebasing/conceptual-overview https://git-scm.com/book/en/v2/Git-Branching-Rebasing