Skip to content

Instantly share code, notes, and snippets.

@paulgeringer
Created April 24, 2015 02:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulgeringer/4cf386b24fe0a50a9339 to your computer and use it in GitHub Desktop.
Save paulgeringer/4cf386b24fe0a50a9339 to your computer and use it in GitHub Desktop.
check for unpushed commits on a branch with an arbitrary remote
def check_remote_branch
if `git branch -a | grep "$(git branch | grep "*" | sed 's/*\ //g')"`.strip == '2'
false
else
true
end
end
def check_unpushed_commits
branch = `git branch | grep "*" | sed 's/*\ //g'`.strip
remote = `git branch -a | grep "#{branch}" | tail -n 1 | cut -d / -f 2`.strip
if `git log #{remote}/#{branch}..HEAD --oneline | wc -l`.strip > '0'
false
else
true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment