Let\'s say I have the following local repository with a commit tree like this:
master --> a \\ \\ develop c --> d
Here is a PowerShell implementation of Mark Reed's solution:
git show-branch -a | where-object { $_.Contains('*') -eq $true} | Where-object {$_.Contains($branchName) -ne $true } | select -first 1 | % {$_ -replace('.*\[(.*)\].*','$1')} | % { $_ -replace('[\^~].*','') }