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

Re: git push refspec to specify tracking branch

From
Avery Pennarun <apenwarr@gmail.com>
Date
Mar 31, 2010, 01:19 UTC
Message-ID
<32541b131003301819x2cab23ffu84b65a0b4c553229@mail.gmail.com>
In-Reply-To
<13A69FD9-234A-4E2A-B83F-096DE304FA16@sb.org>
On Tue, Mar 30, 2010 at 9:06 PM, Kevin Ballard <kevin@sb.org> wrote:
Show 5 quoted lines
> Is there any way in a refspec to specify the tracking branch
> corresponding to a local branch? Specifically, I want to be able to
> write some variant of `git push origin +foo` and have it push foo to
> its tracking branch. I can't find any way to do that according to
> the current documentation.

This is probably a stupid suggestion, but since you're only likely to have a single local branch corresponding to a particular remote branch, the easiest answer is to rename your local branch to have the same name :)

Otherwise, what you probably want is:
   git push origin localbranchname:remotebranchname
You can also delete a remote branch:
   git push origin :remotebranchname
Have fun,
Avery
Previous: Kevin BallardNext: Avery Pennarun
Message 2 of 3 in “git push refspec to specify tracking branch”
  1. Kevin BallardMar 31, 2010
  2. Avery PennarunMar 31, 2010
  3. Avery PennarunMar 31, 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.