- Make a fork of the project to review, and from then on use that fork for the reviews
- Create an empty branch with 'git checkout --orphan', for example git checkout --orphan review-1-target
- Run git status and note that all files are staged. Remove all files by unstaging them first with git reset . and, after, cleanning them with git clean -df.
- On the empty branch, create an empty commit with git commit --allow-empty -m 'Empty commit'
- Push the empty branch to our fork, git push -u origin review-1-target
- Now let’s go to the branch we want to review (say master), and create a new branch from it: git checkout -b review-1.
- We then want to rebase from our empty/target branch. Make sure to place the empty commit as the first commit on the branch, git rebase -i review-1-target
- Push the branch to the fork, git push -u origin review-1
Taken from https://thib.me/recipe-code-reviews-for-existing-code-with-github