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 Merging Basic Merging

Andrew Izquierdo
Andrew Izquierdo
3,212 Points

After you merge a branch onto the master branch, do you ever want to continue working with that branch?

In the second part of the video, after we edited README in both branches....

We were on the master branch, and we did "git merge foo_feature". This caused git to auto-merge the README file on the master branch. While on the master branch, i looked at the README file and saw that it now showed BOTH of the edits that we did. So the merge worked.

But i was curious, and went into the foo_feature branch. While on this branch, i looked at the README file, and noticed that it WASNT auto-merged. This README file only had the original edit that we made while in foo_feature branch.

So, i see that this basic merge will only auto-merge the file that is in the CURRENT branch that you are on. Therefore, would we ever want to continue working with the OTHER branch (foo_feature) , after we merge? Or should we just continue with master and then create a new branch when we are ready to work on new features?

Thanks for the help!

1 Answer

Ari Misha
Ari Misha
19,323 Points

Hello there! You asked an interesting question in my opinion. Here Ima gives you a real-world example. We've got a git model at my workplace which needs to follow for any Bug or Enhancement or Testing. Whenever we're in a sprint(which is like 10 days of Development), We are assigned the issues or bugs or enhancement on Github, and then we make a separate branch for it with that ticket id of Github. As soon as the development is done, all the branches get merged into a Test Branch so that it can be tested for QA. After testing, if all the issues are cleared for the PR(pull request) then the Test Branch gets merged into the master branch, otherwise, the issue caused in the branch for the subsequent GitId gets removed from Test Branch. And Then the master branch gets tested as well.

I had to tell you this 'coz in enterprises, the master branch gets pipelined to the production, which means its directly visible to the clients/end users. So the best practice would be to avoid the coding master branch in general. We also delete that branch as soon as it's cleared for PR as well as on Master.

Andrew Izquierdo
Andrew Izquierdo
3,212 Points

Oh i see, very interesting. Makes sense. Thanks for the answer and the real world example!

Ari Misha
Ari Misha
19,323 Points

Andrew Izquierdo In my years of learning and working as a Software Developer, I've realized that Git might be the most important and most powerful Development Tool a Developer has. If you master Git (I'm pretty sure you'll eventually), Its only gonna put you ahead when working in a development team. (: