Created
March 15, 2015 01:08
-
-
Save elicwhite/253441fd8b503a30c79e to your computer and use it in GitHub Desktop.
Get common git sha ancestor between a sha and a branch
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
getCommonAncestor: function(headSha, baseBranch) { | |
return new Bluebird(function(resolve) { | |
var command = "bash -c 'diff -u <(git rev-list --all " + headSha + ") "+ | |
"<(git rev-list --first-parent " + baseBranch+")' "+ | |
"| sed -ne 's/^ //p' | head -1"; | |
execute(command, function(data) { | |
resolve(data); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment