Stuck in confusion over Master / Origin / Branch when cloning

252 views Asked by At

Thanks for taking a look. Firstly I wouldn't class myself as a GIT expert and can see I have much to learn although I am not a complete novice.

I setup a local server that contains a repo started from bare and I cloned it using Windows Tortoise GIT; I can push back all fine.

I needed to have a version that was a few commits behind running at the same time which I did by cloning and reverting back. I thought this would be simple but I had to do a few things (I am sure most of which was wrong) to get there. "Switch checkout", "revert changes by this", "reset BLAH to this".

Then it got messy and somehow I've got to a point where the repo I started with now has a green branch label (I don't know why it's green and I don't want it to be a branch), and my latest entry has a red branch label and a peachy "origin/Branch..." label.

The branches in the original clone aren't represented as offshoots in the log - it's just one line.

The third generation clone now won't update with anything new. Even if I delete it and clone it all over again. Although I do see references to the new stuff in the response back when I pull it doesn't show in the actual repo log.

Do I need to somehow merge my branches in the first clone? Do I need to reset the head somehow? Have I broken everything?

Sorry if anything is unclear - I must admit I haven't quite gripped the lingo. I do thank anyone for any nugget of info they can offer. :)

1

There are 1 answers

1
David Deutsch On BEST ANSWER

What do I need to do to make the most recent commit the one the second clone updates to?

There are a couple of ways you can skin this cat. If you do not want to change the repository itself, in your second clone simply switch to the branch that has the latest commit: git checkout Branch_871364.... You would have to do this with each new clone, however. What you probably want to know is how to change the repository so that origin/master points to the latest commit, so that new clones will always get the latest. To do that, do the following:

git checkout master
git merge origin/master
git merge Branch_871364... #put the full branch name here
git push

After you do that, origin/master will point to the latest commit.