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

Why didn't Tommy immediately merge his user profile bug fix to his feature branch concerning user profiles?

It seems like he would have wanted that fix immediately in his branch since it concerned the area on which he was working rather than waiting until he merged his branch with master.

2 Answers

Tatiana Perry
Tatiana Perry
17,156 Points

The reason he didn't is that when he fixed the the user problem on the master branch he went back to his adding_github branch. Then at the end he says that he pushed his code to the server and merge with the master branch. The one the fix had been applied to. By merging his github branch with the master the changes to fix the user were then applied to his github branch.

Master Branch - user fixed applied

github branch - merged later, fix from master branch auto applies.

I hope that makes sense.

What helped me as this analogy: You have 2 text files.

Text file 1(master): Says "hello world"

Text file 2(branch): Says "Welcome to Treehouse"

Merge them into a Text file 1(master) and you get "hello world" "Welcome to Treehouse"

What if that bug fix on the master has implications for his branch?

Like in his example say if the master is running new javascript or css, wouldn't that be important for someone to have the new working code updated on their feature branch?

Or is that something a user would need to update on their branch manually?

Tatiana Perry
Tatiana Perry
17,156 Points

If I understand this right. On the master there is new code. And he wants that new code in his branch?

Then he would fetch the latest changes from the master branch, then merge those changes into his branch. This may cause merge conflicts that you would need to fix.

There are 2 options and if a moderator or teacher wants to weight in please :)

git checkout your branch
git merge origin/master

or

git checkout your branch
git rebase master

Check out stackoverflow for more in-depth on rebase: http://stackoverflow.com/questions/457927/git-workflow-and-rebase-vs-merge-questions

and also the git manual: http://git-scm.com/doc