tj.git-extras/man/git-mr.md
Vijay Misal 4c38988ba9
feat(mr): support Forgejo/Codeberg pull request URLs (#1267)
* feat(mr): support Forgejo/Codeberg pull request URLs

Codeberg and other Forgejo instances expose pull requests under
refs/pull/<id>/head instead of GitLab's refs/merge-requests/<id>/head,
so passing a Codeberg pull request URL to git mr fetched the wrong
ref. Recognize the /pulls/<id> URL shape and switch to the matching
ref for that case, leaving the GitLab URL and bare numeric id
behavior unchanged.

Closes #1213

* test(git-mr): cover Forgejo/Codeberg URLs, regenerate man docs

Add a bats test that exercises the pulls URL branch via a local
insteadOf remote rewrite (no real HTTP endpoint needed), and bring
git-mr.1/git-mr.html in line with the git-mr.md changes.

---------

Co-authored-by: vjymisal0 <vijay.looprai@gmail.com>
2026-08-27 13:59:00 +08:00

56 lines
1.3 KiB
Markdown

git-mr(1) -- Checks out a merge request locally
========================================
## SYNOPSIS
`git-mr` &lt;number&gt; [&lt;remote&gt;]<br>
`git-mr` &lt;url&gt;<br>
`git-mr clean`
## DESCRIPTION
Fetches merge request head by its number or URl and check it out in a branch
named with merge request number.
## OPTIONS
&lt;remote&gt;
The name of the remote to fetch from. Defaults to `origin`.
&lt;url&gt;
GitLab merge request URL in the format
`https://gitlab.tld/owner/repository/merge_requests/453`, or a
Forgejo/Codeberg pull request URL in the format
`https://codeberg.tld/owner/repository/pulls/453`.
## EXAMPLES
This checks out merge request `!51` from remote `origin` to branch `mr/51`.
$ git mr 51
From gitlab.com:owner/repository
* [new ref] refs/merge-requests/51/head -> mr/51
Switched to branch 'mr/51'
This checks out pull request `#51` from a Forgejo/Codeberg URL to branch `mr/51`.
$ git mr https://codeberg.org/owner/repository/pulls/51
From codeberg.org:owner/repository
* [new ref] refs/pull/51/head -> mr/51
Switched to branch 'mr/51'
## AUTHOR
Written by Étienne BERSAC <bersace03@gmail.com> from git-pr(1).
## REPORTING BUGS
&lt;<https://github.com/tj/git-extras/issues>&gt;
## SEE ALSO
&lt;<https://github.com/tj/git-extras>&gt;