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 Branches Beginning to Branch

Not understanding branch copies and when they actually become a branch of their own vs. a copy in your current branch.

I'm so lost on this concept that when the instructor said:

"When you create a new branch, it starts off as a copy of whatever branch you're currently using in git.We were still inside the foo_feature branch when we created bar_feature so bar_feature starts off as a copy of the foo_feature branch. If we had switched back to the master branch first, for example, before creating bar_feature we'd have gotten a copy of the master branch, and that commit would not have been there."

I became completely lost about what he was saying, and what's happening. So we used git checkout -b foo_feature to create the bar_feature branch while inside the foo_feature branch. So I thought this would've created a new branch and we would transfer over to the new bar_feature branch. I'm not understanding why we remain in the foo_feature branch with a copy of bar_feature inside it.

I'm also not understanding how/when the bar_feature branch ceases being a copy within the foo_feature branch and when it becomes its own branch like we (I thought) created with the git checkout -b foo_feature. I feel extremely lost on this concept, and perhaps am not understanding it at all. I appreciate any help someone can offer to help me.

Sue Dough
Sue Dough
35,800 Points

Please consider marking answers as correct. I have seen you ask many questions and never give anyone a correct answer.

I don't know if they're correct; they're an idea & ideas help... but I have no clue if they're correct or not as most of my questions aren't straight forward is this right yes/no answers that can be easily checked with no possibilities for exceptions or other ways to solve the problem.

Sue Dough
Sue Dough
35,800 Points

Well test them out and see for yourself. You even told 1 person that makes sense but didn't mark their answer. It is a best answer and can always be changed. Sometimes there is cases where an answer can't be picked for various reasons but we are talking a lot of questions here. I have seen many people answer your questions and I haven't seen you mark 1 as correct ( maybe you have but none I have seen on the dev tools section). People get points for helping answer and more likely to contribute when getting points.

Eh, I handle my questions my own way. I don't care if people give me points or not when I answer questions. I thought the point was to help others to further your own knowledge, perhaps help other people in the future, and provide commentary, and not about the arbitrary points? It seems like these arbitrary points are consuming you here and your "consideration" to provide (you?) points is sounding more like a demand... I'm also not seeing how this is relevant to my question at all & your response below is pretty toxic and unhelpful. Disengaging.

Sue Dough
Sue Dough
35,800 Points

They aren't giving you points. They are suppose to get points for helping! They are helping you for free! Stack overflow wouldn't be successful if it wasn't for points and probably same goes for this forum. If you don't want to help others WHO HELPED YOU FOR FREE then so be it but don't be surprised if people don't want to bother helping you anymore.

Michael Hulet
Michael Hulet
47,912 Points

Hey guys, let's keep this civil here. Regardless of points, it's a good to mark an answer as best simply because it shows on the main page of the Community and in the question itself that the question's been answered successfully and the OP's problem's been solved by an answer. I know the intent of this thread is well-meaning, but marking an answer as best is a function best left to the OP or a moderator

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! Sorry Jonathan Grieve but I must disagree with you on this particular point. The -b flag is meant to take you directly to the branch you just created as indicated in this documentation. However, I believe the confusion is the use of the word "inside" in the quote given. If I say I was inside the master branch when I create Branch1, I mean that I was currently looking and working in the master branch. However, when I then git checkout -b Branch1 I create a copy of the master branch and then move over to the Branch1. This does not mean, however, that Branch1 resides inside the master branch as if it were a file or folder. I think it's important to distinguish the meaning of the use of "inside" here. Then if I were "checked out" to Branch1 and did git checkout -b Branch2 I would create a copy of Branch1 and switch over to Branch2.

As far as points and "Best Answers" go, I can tell you that Treehouse in general considers it good practice to mark an answer as such when there is a very clear best answer. However, that being said, they generally consider it optimal for the original poster of the question to determine that for themselves. In some cases, especially matters of opinion, there will be no clear winner. The points system is meant to be encouragement for learning and for helping others. It (in my humble opinion) should never be a replacement for the satisfaction of the acquisition/application of knowledge.

Hope this helps! :sparkles:

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

It seems like when you use the -b flag it merely creates the branch rather than taking you there.

To switch to the new branch you just need to simply create it and simply use git checkout branch to go safely to that branch! :)