All of lore.kernel.org
 help / color / mirror / Atom feed
* How to use @{-1} with push?
@ 2016-03-25 14:40 Robert Dailey
  2016-03-25 17:45 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Dailey @ 2016-03-25 14:40 UTC (permalink / raw)
  To: Git

I have an alias that I'm working on to do a push and delete of a topic branch:


    # Push HEAD, delete branch local & remote
    #
    # $1 = remote name
    # $2 = branch name
    pushdel = "!f() { : git push ; git push \"$1\" HEAD \":$2\" && git
branch -d \"$2\" ; }; f"


I use it after I merge a topic branch, like so:

$ git pushdel origin my-topic-branch

What would be nice is if I could do one of the two:

$ git pushdel origin -
$ git pushdel origin @{-1}

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. I'm not sure why, as I do not
have knowledge of the underlying mechanics of these commands.

Is there a way I can use these "relative" branch shorthands in my push
command? If not directly, perhaps there is a way I can update my alias
to do an intermediate translation?

Thanks in advance.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-28 14:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-25 14:40 How to use @{-1} with push? Robert Dailey
2016-03-25 17:45 ` Junio C Hamano
2016-03-25 18:02   ` Robert Dailey
2016-03-25 18:11     ` Robert Dailey
2016-03-25 18:58       ` Junio C Hamano
2016-03-28 14:53         ` Robert Dailey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.