At my current job we develop code on a release branch and then do a code review. After all rework is done the final changes are also synced/merged to the ‘main branch’. We want to be sure that all changes are synced correctly. What’s a good way to review this sync work?
Note: the initial versions of files in the release branch and ‘main branch’ can be different. Thus it doesn’t always help to compare the latest version in the release branch with the latest version in the main branch. (You then still see the ‘initial differences’ between both branches, although you don’t see any ‘sync changes’ anymore).
My idea was to compare the ‘delta’ on the release branch with the ‘delta’ on the main branch. By using the GNU diff tool I can generate these two delta’s, and then compare them in a file compare tool. Is this a good idea?
Note: we use ClearCase.
Just to clarify: We can’t (or don’t want to) rebase the release brach to the main branch, just for code review. That would again be a possible way to make mistakes. The release branch contains the code which our customers run. The main branch is used for splitting of new release branches in the future.
5
You should update your version of the main branch against the latest version of the main branch, pulling in changes that have occurred since you branched off for your feature branch. Once this is done you can then compare your differences alone.
Example using git:
First git rebase
(or git merge
but I prefer git rebase
in case of code conflicts) the feature branch against the main branch. You will need to resolve any code conflicts.
Then you can do a git diff
directly to the main branch.
n.b. Do a git fetch
first to make sure you are doing your rebase/merge and diff against the latest version of the main branch.
I don’t know the syntax for ClearCase but the process will likely be similar.
4