Thread (6 messages) 6 messages, 4 authors, 2019-07-31

Re: `@` alias for `HEAD` not working in `git push -u origin @`

From: Johannes Schindelin <hidden>
Date: 2019-07-11 09:46:53

Hi brian,

On Wed, 10 Jul 2019, brian m. carlson wrote:
On 2019-07-10 at 05:06:08, Mark Florian wrote:
quoted
I learned today that `@` is a shortcut for `HEAD`. From `git help reivisions`:

    @ alone is a shortcut for HEAD.

However, when I tried to use it in a command I frequently use, I got an error:

    $ git push -u origin @
    fatal: invalid refspec '@'

I'm running git version 2.22.0 on Linux.

Is this a bug, or have I misunderstood how this is supposed to work?
This is a bug. If the destination side of a refspec is omitted, and the
source side resolves to a ref starting with "refs/heads/" or
"refs/tags/" (which I expect it does here), then that ref is used as the
destination.

I submitted a patch at [0], but it was decided not to pick it up. If
Junio and the list decide that it's wanted, I'm happy to resend or
revise and resend.

[0] https://public-inbox.org/git/20180729192803.1047050-1-sandals@crustytoothpaste.net/
After reading that thread, I come to the conclusion that it was not so
much a decision not to pick it up, but more like a falling between the
cracks.

I would be in favor of this patch.

Since I have your attention and since I am interested in a related issue
(when I wanted to propose a GSoC mini project to let `git fetch <remote>
@` expand the `@` to the current (local) branch name, Matthieu Moy
pointed out that `git fetch --current <remote>` might be a better UI):
what does your patch do with `git fetch`'s refspec arguments?

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help