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.

Development Tools Git Branches and Merging Merging Merging Into Topic Branches

Eduardo Osorio
.a{fill-rule:evenodd;}techdegree seal-36
Eduardo Osorio
Full Stack JavaScript Techdegree Graduate 20,847 Points

Could someone explain the logic behind merging the master branch into the testing branch first?

I mean, couldn't we get the same end result doing it the other way from the start (merging the testing branch into the master branch) instead of what's done in the video (merging master into testing and then testing into master).

Or how would this differ in the end result?

Minardo Toirac Isla
Minardo Toirac Isla
10,329 Points

I think merging master to testing branch could be the start of the creation of the testing branch. Once the changes on the testing breach have been tested and approved, then we can do the merge from testing to the master branch.

1 Answer

Chris Freeman
Chris Freeman
Treehouse Moderator 66,739 Points

Hey Eduardo Osorio, great question! It’s key to remember that many others may be making contributions to the main (master) branch while you’re working on feature (testing) branch.

By merging the main branch into the feature branch, you allow for new main branch changes that occurred after the feature branch was created to be first combined and tested first on the feature branch.

Any conflicts or new bugs can be worked out while still on the feature branch. If no new charges are required, the feature branch can now be merged into the main branch.

If no new main branch changes had occurred, the main to feature merge would cause no changes, and the main+feature merge back to main would be a “fast forward”, meaning that only HEAD pointers are moved and no files need changing.

This is all to protect the main branch from being put in a bad state due to unexpected collisions with unknown updates coming others.

Hope this is clear. Post back if you need more help. Good luck!!!