Skip to content

Instantly share code, notes, and snippets.

@ramonsnir
ramonsnir / git-pushu.sh
Created July 16, 2016 10:10
/usr/local/bin/git-pushu (assumes that you always like your `origin` remote)
#!/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