Skip to content

Instantly share code, notes, and snippets.

@jstockdi
Created May 5, 2017 15:54
Show Gist options
  • Save jstockdi/3910c91b6b34dfc13efe09ec3b32dd9f to your computer and use it in GitHub Desktop.
Save jstockdi/3910c91b6b34dfc13efe09ec3b32dd9f to your computer and use it in GitHub Desktop.
github-codebase-review
BRANCH_NAME=$1
## Checkout empty orphan
git checkout --orphan ${BRANCH_NAME}-empty
## Remove all files
git rm -r --cached *
## Clean all the files
git clean -fxd
# Verify all good
git log
##Create foo commit to create shared history
git commit --allow-empty -m "Start of the review"
## Create review branch from main
git checkout -b ${BRANCH_NAME}-review
## Merge in code to be reviewed
git merge master --allow-unrelated-histories --squash
## Commit squashed commit
git commit -m 'Squash commit!'
## Verify all good
git status
git log
## Push the branches
git push origin ${BRANCH_NAME}-empty
git push origin ${BRANCH_NAME}-review
## Perform code review @ github
## Delete the branches once you are done with the review
#git push origin :${BRANCH_NAME}-empty
#git push origin :${BRANCH_NAME}-review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment