git branch command is incompatible with bash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

I hope posting this to this mailing list is okay, this is the first ever
mail that I submit to a technical mailing list. 

When using the git branch command, git uses a '*' to denote the current
branch. Therefore, in bash this:

	$ branchName=$(git branch -q)
	$ echo $branchName

produces a directory listing, because the '*' is interpreded by the
shell. 

While an (unwieldly) workaround exists:

	$ branchName=$(git symbolic-ref -q HEAD)                                                                            
	$ branchName=${branch##refs/heads/}

it would still be nice, if there were a --current flag, that returned
only the current branch name, omitting the star:

	$ branchName=$(git branch --current -q)
	$ echo $branchName
	master
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]