git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Wishlist for branch management

From
Björn Steinbrink <b.steinbrink@gmx.de>
Date
Feb 1, 2010, 01:31 UTC
Message-ID
<20100201013155.GA11832@atjola.homenet>
In-Reply-To
<4B662BEF.7040503@zytor.com>
On 2010.01.31 17:18:39 -0800, H. Peter Anvin wrote:
> git branch --current
> 
> ... list the current branch name, for use in scripts.  Equivalent to:
> 	"git branch | grep '^\*' | cut -c3-"
In scripts, plumbing should be used. I use:
	git rev-parse --symbolic-full-name HEAD

This gives either the full refname of the checked out branch head, e.g. refs/heads/master, or HEAD in case of a detached HEAD.

> git push --current
> 
> ... push the current branch, and only the current branch...
Unless you want to push to a different ref remotely, e.g. pushing
refs/heads/master-public to refs/heads/master, you can use:
	git push <remote> HEAD
For example, when refs/heads/master is checked out, then:
	git push origin HEAD
acts the same as:
	git push origin refs/heads/master
Björn
Previous: H. Peter AnvinNext: H. Peter Anvin
Message 2 of 5 in “Wishlist for branch management”
  1. H. Peter AnvinFeb 1, 2010
  2. Björn SteinbrinkFeb 1, 2010
  3. H. Peter AnvinFeb 1, 2010
  4. Petr BaudisFeb 1, 2010
  5. H. Peter AnvinFeb 1, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.