The fact is that when I wrote the Makefile for my project, when I needed to determine the current name of the branch, in make make I did this:
check_branch:
if [ "$(git rev-parse --abbrev-ref HEAD)" == "master" ]; then \
echo "In master"
else \
echo "Not in master"; \
fi
When I called make check_branch, "$ (git rev-parse --abbrev-ref HEAD)" did not work, it returned "" an empty string. But instead, when I changed $ () to ,, it worked fine.
check_branch:
if [ "`git rev-parse --abbrev-ref HEAD`" == "master" ]; then \
echo "In master"
else \
echo "Not in master"; \
fi
Why does $ () not work, but did? For git team only.
Note that in my Makefile I usually used $ () in many rules.
Thank:)
hanhp source
share