git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git branch command is incompatible with bash
@ 2015-07-27 12:12 Anatol Rudolph
  2015-07-27 21:11 ` Johannes Sixt
  0 siblings, 1 reply; 9+ messages in thread
From: Anatol Rudolph @ 2015-07-27 12:12 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-07-29  0:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-27 12:12 git branch command is incompatible with bash Anatol Rudolph
2015-07-27 21:11 ` Johannes Sixt
2015-07-27 21:49   ` Junio C Hamano
2015-07-28  7:28     ` Johannes Sixt
2015-07-28 10:01       ` Jakub Narębski
2015-07-28 15:23       ` Junio C Hamano
2015-07-28 16:25         ` Jeff King
2015-07-28 17:27         ` Johannes Sixt
2015-07-29  0:23         ` Scott Schmit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).