Skip to content

Instantly share code, notes, and snippets.

@BryceCicada
Last active July 24, 2019 02:34
Show Gist options
  • Save BryceCicada/2db730cd3645512965178651cc11333e to your computer and use it in GitHub Desktop.
Save BryceCicada/2db730cd3645512965178651cc11333e to your computer and use it in GitHub Desktop.
Git code reviews
  1. Ammend project .git/config to fetch pull/merge requests from the remote:

    1. 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/*
    
    1. 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/*
    
    1. 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/*      
    
  2. Add the following git alias to project .git/config:

[alias]
  mp = !git merge --no-ff --no-commit "$@" 
  1. Add the following to .bashrc

    1. Github: cr () { git fetch origin && git mp origin/pr/$1; }
    2. Gitlab: cr () { git fetch origin && git mp origin/merge-requests/$1; }
    3. Gerrit: cr () { git fetch origin && git mp origin/changes/69/49369/1; }

Different approach at https://docs.gitlab.com/ee/user/project/merge_requests/#checkout-merge-requests-locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment