I've been using git on command line for quite a while in BitBucket and Github, but recently I started using Azure Repos.
One feature that I'm used to is, whenever I push a new branch to the upstream for the first time, the remote will give me the url to create a pull request for that particular branch.
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'.
However, the Azure repos service does not return this url exactly, it returns just the repository URL and you have to go there, select the branch you just pushed to the upstream and then create the PR.
Example from Azure Repo:
$ 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'.
Is this a config or something that I could change in the interface somewhere or this is just a feature that azure doesn't have and the others do?
Edit:
As pointed by @hross this is not available as of now in Azure Repos. One way of getting to the branch (not exactly the pr creation, but Azure will mention the branch was just pushed and offer to create the PR) is this one:
echo $(git remote -v | awk 'NR==1{print $2 "?version=GB"}')$(git rev-parse --abbrev-ref HEAD)
So I added it to AutoHotkey as the command gpush
so when I type that in my git bash it will give me the address. I can also use as a quick way to navigate to whatever branch and repo I'm working even if I don't want to create a PR.
::gpush::echo {$}(git remote -v | awk 'NR==1{{}print {$}2 "?version=GB"{}}'){$}(git rev-parse --abbrev-ref HEAD)
Existing pull requests have an ID in the URL, which you'll need to specify; if you don't know the ID, then you'll need to get the URL from the GUI ( https://bitbucket.org/owner/repo/pull-requests/ is probably the easiest place to find it).
From the Pull Requests view, select New Pull Request. Select the source and target branches, enter a title and optional description, and select Create. After the PR is created, select Open in browser to open the new PR in the Azure DevOps web portal.
Get the clone URL of an Azure Repos Git repoFrom your web browser, open the team project for your Azure DevOps organization, and then choose Repos > Files to open the Files view. In the Files view, choose Clone to launch the Clone Repository popup. Copy the clone URL from the Clone Repository popup.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With