Re: How to use @{-1} with push?
- From
- Robert Dailey <rcdailey.lists@gmail.com>
- Date
- Mar 25, 2016, 18:02 UTC
- Message-ID
- <CAHd499B3Z58hj--Pa0uM36A2H3Xpmayrb+RiLeOBkmnu70yW1A@mail.gmail.com>
- In-Reply-To
- <xmqq8u164fjv.fsf@gitster.mtv.corp.google.com>
On Fri, Mar 25, 2016 at 12:45 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 17 quoted lines
> 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.