Skip to content

Instantly share code, notes, and snippets.

@ekilah
Created August 27, 2015 23:09
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ekilah/88a880c84a50b73bd306 to your computer and use it in GitHub Desktop.
Save ekilah/88a880c84a50b73bd306 to your computer and use it in GitHub Desktop.
Git alias to push current branch to upstream branch of the same name
[alias]
pushup = "!gitbranchname() { git symbolic-ref --short HEAD; }; gitpushupstream() { git push --set-upstream origin `gitbranchname`; }; gitpushupstream"
@dmr-loggly
Copy link

Thanks for posting this on the web, I was trying to figure out how to make exactly this alias. 👍

@ekilah
Copy link
Author

ekilah commented May 29, 2016

late reply, but no problem! glad it helped

@zenlor
Copy link

zenlor commented Aug 25, 2016

just a note to self (this is easier to even remember)

[alias]
    pushup = "!git push --set-upstream origin $(git symbolic-ref --short HEAD)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment