-
Ammend project .git/config to fetch pull/merge requests from the remote:
- Github:
[remote "origin"] url = git@github.com:cakesolutions/arm-vaas.git fetch = +refs/heads/*:refs/remotes/origin/* fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
- Gitlab:
[remote "origin"] url = git@github.com:cakesolutions/arm-vaas.git fetch = +refs/heads/*:refs/remotes/origin/* fetch = +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*
- Gerrit
[remote "origin"] url = ssh://eu-gerrit-2.euhpc.arm.com:29418/ivg/imaging/face-recognition/face-recognition fetch = +refs/heads/*:refs/remotes/origin/* fetch = +refs/changes/*:refs/remotes/origin/changes/*
-
Add the following git alias to project .git/config:
[alias]
mp = !git merge --no-ff --no-commit "$@"
-
Add the following to .bashrc
- Github:
cr () { git fetch origin && git mp origin/pr/$1; }
- Gitlab:
cr () { git fetch origin && git mp origin/merge-requests/$1; }
- Gerrit:
cr () { git fetch origin && git mp origin/changes/69/49369/1; }
- Github:
Different approach at https://docs.gitlab.com/ee/user/project/merge_requests/#checkout-merge-requests-locally