Handling detailed code reviews in GIT

· Read in about 1 min · (145 words) ·

  • Pull Requests are sometimes not sufficient - they allow to see changes, perhaps you can even see that a test build passed but these do not allow for actual functional testing or even navigating thru the code.
  • Some times it is convenient to see all the changes in staging area (similar to TFS unshelve functionality) so functional test can be done and code can be reviewed more deeply.

Below steps allow to achieve the same state as for TFS unshelve - you end-up with code checked out and staged in GIT:

  1. Fetch remote changes
    • git fetch origin
  2. Checkout target branch
    • git checkout TargetBranchName
  3. Do dry merge (without commit)
    • git merge --no-commit --no-ff origin/ReviewedBranchName

Now you can do the detailed code review, put comments into PR, do testing, navigate thru references usign Resharper in Visual Studio etc.

Once done just abort the merge:

  • git merge --abort