How to review the whole master branch
There is a silly problem which is there, nevertheless.
UPD: Turned out, Github DOES NOT allow this trick. I verified that it works in Gitlab, though.
You wrote an exploratory code, and it’s in a master
branch of a new repository. After some time it’s almost production ready, and you want to have a review by someone.
There is no branch to ‘merge to’. Everything is in master
. How to review it? If there is no pull request or merge request, there is no place for comments and general niceness of Gitlab/Github interfaces. You need to have a merge request.
But your first commit looks like ‘saving initial version’, and diff between first commit and HEAD is crazy. You want a diff between “nothing” and the HEAD.
Here is the trick:
git checkout --orphan for_review
git rm --cached .
git commit -m 'initial commit' --allow-empty
git push --set-upstream origin for_review
Bingo. Now you have a totally empty branch ‘for_review
’ . You can now make a proper merge request from the master
to this new branch.
The main trick is in --orphan
option for git, which creates a new branch with ‘nothing’ inside.
Just don’t forget to remove mark from ‘delete original branch’ checkbox when creating a merge request (or you’ll delete a master
)
You can remove ‘for_review
’ branch later, after addressing everything changed during review in the master
. (The changes are in the master anyway).
This is a silly solution for a silly problem, but it allows to use good tools, which otherwise won’t be available.