Skip to content

Instantly share code, notes, and snippets.

@gundamew
Created March 6, 2019 04:08
Show Gist options
  • Save gundamew/1ada9aadb39b8b2539ffd44c4faf094a to your computer and use it in GitHub Desktop.
Save gundamew/1ada9aadb39b8b2539ffd44c4faf094a to your computer and use it in GitHub Desktop.
Checkout GitLab merge request locally.
#!/usr/bin/env bash
set -euo pipefail
# Ref:
# * https://stackoverflow.com/a/44992513
# * https://github.com/jwiegley/git-scripts/blob/master/git-pr
test -z $1 && echo "Merge request number required." 1>&2 && exit 1
git fetch ${2:-origin} merge-requests/$1/head:mr-$1 && git checkout mr-$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment