[Tips and Tricks] Managing Merge Requests locally

I like working locally when merging merge requests and pull requests.

LibreHealth straddles between GitHub and GitLab.

I use two zsh functions, which will also work on bash:

GitHub:

gpr() { git fetch $1 refs/pull/$2/head:$3 }

GitLab:

gmr() { git fetch $1 refs/merge-requests/$2/head:$3}

Using them like such:

For GitLab:

gmr origin 1 someTitleForTheLocalBranch

Similar for GitHub:

gpr origin 1 someTitleForTheLocalBranch

A note: origin assumes the remote is named origin – usually, the remotes are named upstream, with my fork being origin.

Hope this helps others.