I don't follow

my repo is a mess now… I don’t know how to get the snowman scene back into master, I don’t know my HEAD is showing or what that is…

the challenge that messed up this whole thing was “make two hanging branches” but @ben only made one and showed how to deal with one, I guess I have to start the course over and I’m not doing that right now, I got other courses to finish… the challenge should have been clearer because it derailed the course for me and I don’t have the knowledge to recover

HEAD indicates that instead of checking out a branch, you’ve checked out a specific commit somewhere else that has no branch pointer.

Checking out any other branch (whether it’s the top commit for prototype-snowman or another branch) should resolve that for you.

Basically checking out a commit like that can be useful if:

  1. You just want to see what was going on with the code at that point in time
  2. You have decided to create a new branch from this point to go off and try something else

But if you don’t keep it or do anything with it, that’s fine too. Then you’ll be back to having master plus two other ‘hanging’ branches (I actually don’t like that term because a branch is a branch; whether it’s just behind another one as in one of them in Ben’s case or truly splintering off to a complete other code timeline, makes no difference at all to git really, it’s just how the graph and lines were laid out).

Ben resolved the first of the two branches in “cc 4” (introducing merges), which was a straight merge or catching up of master and then deleting the unnecessary branch.

It’s common when starting your journey with git scm to end up with a ‘messy’ repository (branches cross-merging back and forth); I wouldn’t worry about that too much for now, and in time you can get better at and develop your own preferred branching strategies that keep a “cleaner” look for following.

The only other thing I might suggest whilst you’re going through and learning some of these concepts, is that if you backup (zip or copy) the folder with your unity project and git repository in it, then should you make a change that makes a mess of your repository, you can just restore it again from the backup.

Not usually necessary when you use git for real; a mistaken merge or commit can just be undone, reset, etc., but for when you’re learning it can be helpful so that if something doesn’t look right after a change, you can try again in case there was a missed option or action that can make all the difference.

I realise it’s perhaps frustrating, but this is one of those things/skills that “pays for itself” once you do learn it, for the times that it will allow you to recover from a mistake or even just offering explanations and history for how things got to where they are now.

1 Like

thanks for taking the time to respond and help… I’m a lot calmer now… maybe I will try to repeat the videos and get back in… I took the course because I have a production project I messed up because I lack the knowledge to really wield Sourcetree, and I don’t know how to roll back to a commit and discard my uncommitted… so the course was really important… then I screwed that up too so I was feeling very defeated…

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms