Created
July 16, 2016 10:10
-
-
Save ramonsnir/9ecd4624fe29218257c78b0308f6a5aa to your computer and use it in GitHub Desktop.
/usr/local/bin/git-pushu (assumes that you always like your `origin` remote)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if ( git status | grep "origin" -q ); then | |
git push $@ | |
else | |
branch_name="$(git symbolic-ref HEAD 2>/dev/null)" | |
git push --set-upstream origin "${branch_name##refs/heads/}" | |
git push $@ | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment