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

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Question about Git

Hi all,

So I have a burning question about using Git.

At the moment I'm working on a project, you've probably seen it on the other thread I posted on an hour ago.

When I'm following a Treehouse course using Git, I tend to create 1 branch for each section plus the master branch. I've finished following the videos for section 2 but there's one piece of functionality missing.

Can I then carry on with section 3, with the new branch I created, checkout to s2 to finish that functionality... and then merge that into the section 3 branch? Or is that far too likely to cause merge conflicts?

To that end, are merge conflicts an unavoidable part of Git development?

Thanks :)

1 Answer

Hi Jonathan,

We use git all the time and very rarely do we run into merge conflicts. Since you are the only person working on the project you could make it a lot easier on yourself.

We (try to) follow the practice of commit small and commit often. While this sounds redundant, it does make it easier when something breaks at a specific point. We uses branches when testing/adding something new from a main branch.

Examples: Updated header/styles for header - Commit this. Updated footer/styles for footer - Commit this.

etc etc. When done push.

In your case, I personally would create a branch if trying to troubleshoot something specific or test something I wasn't sure of outside of the lesson. In the event you need to go backwards you can just look at the commit message and could include the title of said lesson in it for keeping track.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

Hi Mark,

Yup, sound advice. This post and others elsewhere have turned my way of thinking around. What I had in mind was to try and rewrite Git history, instead of doing what you and others have suggested, make new history with a git branch specifically for fixing specific issues. And all I could see with that method was Git oblivion.

I appreciate you chipping in though :)