Bash script: how does the $ wildcard work in git script?

Project:Programming
Component:Documentation
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Related pages:#5408: git: git branch name programmatically :-:-: #5409: bash: echo
Tags:bash script, echo, git
Description

I checked that the following is true, but I still don't understand why or how it works:

#!/bin/bash

git checkout production.release.4.2
production_branch=`git branch | grep "production"`

# May not give the expected result:
# the character $ is being treated as a wildcard and will be expanded, so that the output may include all files in the directory:
echo $production_branch
# Using double quotes solve the problem:
echo "$production_branch"