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

Re: How to use @{-1} with push?

From
RDRobert Dailey <rcdailey.lists@gmail.com>
Date
Mar 25, 2016, 18:11 UTC
Message-ID
<CAHd499BCciG5Udd_sj550jPKg_ahZmWOi-zUOU-cr_wYmri=Rg@mail.gmail.com>
In-Reply-To
<CAHd499B3Z58hj--Pa0uM36A2H3Xpmayrb+RiLeOBkmnu70yW1A@mail.gmail.com>
On Fri, Mar 25, 2016 at 1:02 PM, Robert Dailey <rcdailey.lists@gmail.com> wrote:
Show 22 quoted lines
> On Fri, Mar 25, 2016 at 12:45 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> You can ask rev-parse to give you --symbolic-full-name, error out if
>> it is empty (i.e. detached HEAD), and otherwise use the result, no?
>>
>>     $ git checkout next
>>     $ git checkout master
>>     $ git rev-parse --symbolic-full-name @{-1}
>>     refs/heads/master
>>     $ git checkout HEAD^0
>>     $ git checkout master
>>     $ git rev-parse --symbolic-full-name @{-1}
>>     $ exit
>>
>> And
>>
>>     $ git push origin :refs/heads/master
>>
>> would be the fully-spelled out way to remove that branch.
>
> Thanks Junio, I figured there was a command to do that. I tried to do
> this using '-' shorthand, but that didn't work. I guess because that's
> not really a revision, but a special function of git checkout only.
So the push works with the fully-qualified ref, but not git branch:

$ git rev-parse --symbolic-full-name foo refs/heads/foo

$ git branch -d refs/heads/foo error: branch 'refs/heads/foo' not found.

Any reason for this? I'm using git 2.7.4 on windows
Previous: Robert DaileyNext: Junio C Hamano
Message 4 of 6 in “How to use @{-1} with push?”
  1. Robert DaileyMar 25, 2016
  2. Junio C HamanoMar 25, 2016
  3. Robert DaileyMar 25, 2016
  4. Robert DaileyMar 25, 2016
  5. Junio C HamanoMar 25, 2016
  6. Robert DaileyMar 28, 2016

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.