The command
$ git branch --contains HEAD
returns
* goofing_around
as I expect. But I want to store this in a bash variable, so I run
$ bbb=$(git branch --contains HEAD)
and then I check the contents of bbb
...
$ echo $bbb
... and get ...
file1 file2 file3 goofing_around
(file1
etc. are indeed files in the directory.) What is going on? How can I store just that first line that gives me the current branch name?