After pushing a change, I see text like this:
Writing objects: 100% (5/5), 478 bytes | 239.00 KiB/s, done.
Total 5 (delta 4), reused 0 (delta 0)
remote:
remote: Create pull request for my-branch => master-branch
remote: https://bitbucket.org/my-company/repo/pull-requests/12345
But if I don't make a PR at that time, and the text scrolls out of view, that URL is gone. How can I simply generate or re-view that URL without making a change and committing/pushing again?
Once you've committed changes to your local copy of the repository, click the Create Pull Request icon. Check that the local branch and repository you're merging from, and the remote branch and repository you're merging into, are correct. Then give the pull request a title and a description. Click Create.
Under your repository name, click Pull requests. In the list of pull requests, click the pull request that you'd like to link to an issue. In the right sidebar, in the "Development" section click . Click the issue you want to link to the pull request.
Now you can use the gpr command straight from your command line to automatically open a page to compare two remote branches and start the Pull Request process automatically!
I was able to generate the URL using a batch file like this:
@echo off
setlocal
for /f "tokens=*" %%a in (
'git rev-parse --abbrev-ref HEAD'
) do (
set branch=%%a
set url=https://bitbucket.org/my-company/repo/pull-requests/new?source=%%a^^^&t=1
)
echo %url%
endlocal
It simply grabs the current git branch and puts in a string, then echoes the string.
This pull request URL is not a git feature but a message generated by a hook script on the BitBucket server.
On a BitBucket server, you can disable it globally with: How do I disable the remote create pull request message when pushing changes?. On the BitBucket cloud you cannot disable it.
One soultion to obtain this message would be to simulate a git pull
with the --dry-run
option, such as :
git pull --dry-run
but if this is not enough to trigger the hook, probably that the only way is to go through the BitBucket web interface.
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