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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert Dailey <rcdailey.lists@xxxxxxxxx> writes:

> Both should refer to the last branch, but I know that these can't be
> used verbatim in a push command because it doesn't read it as a branch
> name normally like `git checkout` would.

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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]