I am attempting to write a new alias command that performs the following:
git push origin [current branch]
I have the following to return the current branch
git rev-parse --abbrev-ref HEAD
I cannot work out:
a) how to add two commands to one line and not have them run procedurally. E.g return the current branch but then also run it on one line. I have tried the following alias:
alias "gps cb"="git push origin \"git rev-parse --abbrev-ref HEAD\""
b) how to have an alias with a space in it e.g gps cb, I have a separate for just gps so I'd rather keep the pattern of having a space afterwards in the alias so it's not too much mental legwork to write gps master and gps cb
git pushdefaults to both current branch andoriginif you don't specify, meaning thatgit pushshould already do what you're asking for, or am I missing something?gitalias instead of a shell alias, which would allow you to write something likegit pcb. Untested, but I think you would addalias.pcb = '!git push origin $(git rev-parse --abbrev-ref HEAD)'to your~/.git/configfile.