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 Branches and Merging Merging Merging Into Topic Branches

Eduardo Osorio
seal-mask
.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?

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
MOD
Chris Freeman
Treehouse Moderator 68,423 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!!!