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, 03:24 UTC
Message-ID
<32541b131003302024n42994e3nddab7544c24f93bd@mail.gmail.com>
In-Reply-To
<5D7B2F13-760B-4EBE-93A4-06B9CDDC3976@sb.org>
On Tue, Mar 30, 2010 at 10:24 PM, Kevin Ballard <kevin@sb.org> wrote:
Show 8 quoted lines
> On Mar 30, 2010, at 6:19 PM, Avery Pennarun wrote:
>> git push origin localbranchname:remotebranchname
>
> Yes that works, but it's annoying to type out every time, especially when my
> branch has a long name and I don't want to risk typos. Even worse, the
> tab-completion in bash uses `git ls-remote` to complete the remote part of
> refspecs, so it's even slower to type "foo:kba<tab>" than it is to type
> "foo:kballard/foo".

You might consider creating a separate 'remote' entry then in your .git/config. You should be able to reconfigure the refspec on that one to use a particular branch name instead of a wildcard. It's not exactly pretty, but laziness will be laziness.

A similar option would be to just make a shell alias and be done with it:
savebranch()
{
    git push origin $1:kballard-$1
}
Have fun,
Avery
Previous: Avery Pennarun
Message 3 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.