I have a git repository with 2 branches:
$ git branch
* master
test/branch
I can list specific branches individually by doing the following:
$ git branch --list master
* master
$ git branch --list test/branch
test/branch
However, when I store this command as a variable, I get unexpected results:
$ LOCAL=$(git branch --list master); echo $LOCAL
index.php readme.md master
$ LOCAL=$(git branch --list test/branch); echo $LOCAL
test/branch
The results aren't always consistent. Sometimes I get unexpected results from branches with forward slashes, sometimes without, depending on the repository I'm working with. I can't put my finger on what's happening exactly or why.
Why does listing one branch list files in the directory and the branch itself, and the other one just lists the branch?