Created
April 24, 2015 02:31
-
-
Save paulgeringer/4cf386b24fe0a50a9339 to your computer and use it in GitHub Desktop.
check for unpushed commits on a branch with an arbitrary remote
This file contains 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
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