我已经在BitBucket和Github中的命令行上使用git了一段时间,但是最近我开始使用Azure Repos。
我习惯的一个功能是,每当我第一次将新分支推送到上游时,远程服务器就会为我提供用于为该特定分支创建请求请求的URL。
BitBucket:
$ git push --set-upstream origin test-1
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 266 bytes | 266.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote:
remote: Create pull request for test-1:
remote: https://bitbucket.org/xxxxxxxxxxx/test-pr-message/pull-requests/new?source=test-1&t=1
remote:
To https://bitbucket.org/xxxxxxxxxxx/test-pr-message.git
* [new branch] test-1 -> test-1
Branch 'test-1' set up to track remote branch 'test-1' from 'origin'.
GitHub:
$ git push --set-upstream origin test-1
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 266 bytes | 266.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
remote:
remote: Create a pull request for 'test-1' on GitHub by visiting:
remote: https://github.com/xxxxxxx/test-pr-message/pull/new/test-1
remote:
To https://github.com/xxxxxxx/test-pr-message.git
* [new branch] test-1 -> test-1
Branch 'test-1' set up to track remote branch 'test-1' from 'origin'.
但是,Azure仓库服务未完全返回此URL,它仅返回存储库URL,您必须去那里,选择刚推送到上游的分支,然后创建PR。
Azure存储库中的示例:
$ git push --set-upstream origin test-1
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 276 bytes | 276.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Analyzing objects... (3/3) (5 ms)
remote: Storing packfile... done (41 ms)
remote: Storing index... done (30 ms)
To https://dev.azure.com/xxxxxxxxxxxxxxx/test-pr-message/_git/test-pr-message
* [new branch] test-1 -> test-1
Branch 'test-1' set up to track remote branch 'test-1' from 'origin'.
这是配置还是我可以在某个地方的界面中更改的东西,或者这仅仅是azure没有的功能,而其他功能却有?
编辑:
如@hross所指出的那样,Azure Repos中目前尚不可用。进入分支机构的一种方法(不完全是创建公关,但Azure将提到分支机构已被推送并提供创建PR):
echo $(git remote -v | awk 'NR==1{print $2 "?version=GB"}')$(git rev-parse --abbrev-ref HEAD)
因此,我将其作为命令gpush
添加到了AutoHotkey中,因此当我在git bash中键入该地址时,它将给我地址。即使我不想创建PR,我也可以使用一种快速的方法来导航到我正在工作的任何分支并进行回购。
::gpush::echo {$}(git remote -v | awk 'NR==1{{}print {$}2 "?version=GB"{}}'){$}(git rev-parse --abbrev-ref HEAD)
答案 0 :(得分:2)
This is just a feature that Azure Repos does not currently support (but I'm on the dev team so I added it to our backlog).