Reputation: 9000
Is there any way to do git switch
ignoring the case of the branch name?
So if I have the branch with name QA
, this will not work
git switch qa
Is there any way to make it work?
I am actually making an automated tool where I switch branches of many repositories, so some of my repositories have branch name qa
and some with name QA
and so the global script does not work even though the repositories have same name
Upvotes: 0
Views: 62
Reputation: 69
Though git doesn't provide us with the obvious way, there is a simple way to achieve this
you can use grep
to solve your problem
git checkout $(git branch | grep -iF "QA")
Upvotes: 0
Reputation: 1693
No, there's no way to do that.
Because git branch is case sensitive
. That means you can actually have two different branch named qa
and QA
. They are completely two different branches.
If I run the following commands, it will create two branches.
$ git branch qa
$ git branch QA
Which I can confirm by running the following.
$ git branch
QA
* master
qa
So, you have to create all the branches with same case
letter or you find out what branch that repo has and take action accordingly.
Upvotes: 2