找出哪个存储库用于创建分支
Find out which repository was used to create a branch
有没有办法找出在 Sourcetree 或 GIT 中使用哪个分支创建分支?
git remote -v
给你远程仓库。
如果你想找出你的父分支,你可以看看this other thread,似乎有所有不同的答案。
我在 Windows,所以我尝试了这个并且使用 PowerShell 对我有用:
git show-branch -a | where-object { $_.Contains('*') -eq $true} | Where-object{$_.Contains($branchName) -ne $true } | select -first 1 | % {$_ -replace('.*\[(.*)\].*','')} | % { $_ -replace('[\^~].*','') }
确保将 $branchName 替换为当前分支名称,或者在 运行 命令之前提前设置。
如果您在 bash
上,那里还有很多答案使用 grep
和 sed
以及其他 bash
实用程序来执行相同的解析git show-branch
命令输出。
有没有办法找出在 Sourcetree 或 GIT 中使用哪个分支创建分支?
git remote -v
给你远程仓库。
如果你想找出你的父分支,你可以看看this other thread,似乎有所有不同的答案。
我在 Windows,所以我尝试了这个并且使用 PowerShell 对我有用:
git show-branch -a | where-object { $_.Contains('*') -eq $true} | Where-object{$_.Contains($branchName) -ne $true } | select -first 1 | % {$_ -replace('.*\[(.*)\].*','')} | % { $_ -replace('[\^~].*','') }
确保将 $branchName 替换为当前分支名称,或者在 运行 命令之前提前设置。
如果您在 bash
上,那里还有很多答案使用 grep
和 sed
以及其他 bash
实用程序来执行相同的解析git show-branch
命令输出。