Skip to content

Instantly share code, notes, and snippets.

@peterneave
Last active March 1, 2022 23:35
Show Gist options
  • Save peterneave/b23b47c1398ba9c93cf420d93cd957b6 to your computer and use it in GitHub Desktop.
Save peterneave/b23b47c1398ba9c93cf420d93cd957b6 to your computer and use it in GitHub Desktop.
SourceTree Go To Bitbucket
#Script to Run: C:\Program Files\PowerShell\7\pwsh.exe
#param: c:\dev\GoToBitBucket.ps1 $REPO $SHA
Param(
[string]$REPO,
[string]$SHA
)
pushd $REPO
$var = (git remote get-url origin) | Out-String
popd
$regex = '(?<=:)[\w-.\/]+(?=\.)'
$var -match $regex | Out-Null
$ownerAndRepoPath = $Matches[0]
$url = "https://bitbucket.org/$ownerAndRepoPath/commits/$SHA"
& "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" $url
#& "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" $url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment