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 |