Compare Revisions
You can compare any two revisions of a Git repository. The base revision indicates the starting point of the comparison and the compare revision indicates the end point. The revision could be a branch, a tag, or a commit SHA-1 checksum hash.
Here's how to compare two revisions of a Git repository:
You can compare these revisions:
-
Branch versus branch
-
Tag versus tag
-
Commit versus commit
-
Branch versus tag
-
Commit versus branch
-
Tag versus commit
On the Compare Result page, the Changed Files tab and the
Commits tab. The Changed Files tab
lists files that have changed between the base revision and the compare revision.
The Commits tab lists all commits that have happened between
the base revision and the compare revision since their common commit. The
Commits tab is enabled if From Merge
Base is selected in From Merge Base or
Revisions
.
Action | How To |
---|---|
Compare with a parent of the base revision |
From the Base Revision drop-down list, click the Parents tab, and then click the SHA-1 checksum hash of the parent commit. |
View differences between the base revision and the compare revision since the last common commit to both revisions |
From the From Merge Base or Revisions |
Switch the base revision and the compare revision |
Click Switch Base
|
Create or open a merge request |
If a merge request exists with the Compare Revision as the review branch, click the merge request button to open the merge request review page. If a merge request doesn’t exist, click + Merge Request to create a merge request with Base Revision as the target branch and the Compare Revision as the review branch. |
View the compare options |
Click Diff Preferences
|
Add Comments to a File
When you're comparing files, you can add inline comments, which will be visible to all project users, to the source code changes made to a file:
