Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git - two branches named the same? Difference is one lower case - one mixed case?

I am so used to typing in camelCase that I have been doing it in git. That is - until I realized git is case sensitive!! File names included.

From history - at the start of this production branch - it was ClientMgr. But just at the start.

All the work past the initial commit - has been on branch - clientmgr.

A few hours ago - I realized the problem. Since the tree was straight - and not branches - I tried deleting ClientMgr. Right after - I had 195 new files when before all was clean.

Unsure - I restored a backup - but now have two branches - with the same name - different cases.

Do I continue on - and just ignore the ClientMgr? Or is there a sane way to clean this up?

I would really love to end up with one. I have some ideas - but tired at gitting shot it...

Any and all suggestions appreciated.

P.S. - guess this helps explain why I had some missing / lost changes a few days ago.

I love git - hope to get past or mostly past the got-ya's +++++++++++++++++++++++ Edit: 4/1/2013

The ClientMgr was the original branch - with one commit. I continued working (thinking I was on the ClientMgr branch but instead the new clientmgr branch.

I am concerned because of the same name - different case I think is potential time bomb. That is I suspect - git mostly treats them as separate - but not always. For example - when on ClientMgr - and trying to check clientmgr - I get an error message that I am already on it.

Seeing this - there could be other problems looming with this.

I think my first step will be to backup again - and then try to rename ClientMgr to where there is not similarity - and test and see how that goes.

It that goes well - at least I have (or may have) taken care of the

Once again - I greatly appreciate everyone input.

Jim H

+++++++++++++++++++++++++ Edit 2

Not what expected - but seems ok

I renamed ClientMgr to oldclientmgr via git branch -m ClientMgr oldclientmgr

Looking at the tree in SourceTree - it renamed both to oldclientmgr I checked the graph - and I looked to be where I wanted to be I opened and reviewed the code - and it look to be properly in place

So as I thought - git is not always case sensitive - or it would not have renamed both branches.

Once again - thank you!

Jim H

like image 950
JimH Avatar asked Mar 26 '26 18:03

JimH


1 Answers

If you have continued to work on two separate branches (or did some work on one branch, then on another), you need to merge these changes. This can be done in two ways:

  1. You can use git merge (when on branch clientmgr invoke git merge ClientMgr)
  2. You can use git rebase

Second solution is a bit harder, especially when you are new to git. Both solutions might need you to resolve conflicts, as changes in both branches may not be compatible. If ClientMgr branch was originated directly from clientmgr your merge should be fast-forward, which means there are no possible conflicts, as all changes in branch ClientMgr are made on top of clientmgr branch.

like image 112
samuil Avatar answered Mar 28 '26 10:03

samuil