Hi Efraim,

Efraim Flashner <efr...@flashner.co.il> writes:

On Sat, Feb 08, 2025 at 12:50:22PM -0800, Ian Eure wrote:
Hi all,

Vagrant Cascadian <vagr...@debian.org> writes:

> When working with salsa.debian.org (a gitlab instance) there > is a way to > fetch all the merge requests for a given git repository, so > it just > becomes part of my normal workflow and to some extent works > offline. If
> codeberg had a similar feature, that would be great!
> Adding this line to the remote in .git/config will make PRs visible locally:

   fetch = +refs/pull/*/head:refs/remotes/origin/pr/*

Alternately, you can add a separate remote just for PRs:

   [remote "pulls"]
       url = g...@codeberg.org:org/reop.git
       fetch = +refs/pull/*/head:refs/remotes/pulls/pr/*

The latter setup can speed some workflows, since you can choose to fetch PRs
or not.

These work for any Forgejo or Giteainstance, and I believe work the same on
GitHub/GitLab also.

Is there a way to add this my the global gitconfig so that it happens
automatically for all remotes from a specific forge?

I don’t believe so. There may be a way to add it for all cloned repos, but I doubt it can be done automatically based on a remote pattern.

Probably the best bet is to write a script which uses `git-config' to set it up, and either run that after cloning, or create a second `clone-pulls' which wraps `git-clone' and the script to configure the PR remote.

 -- Ian

Reply via email to