On Gitlab, how to compare a file of two different commits

后端 未结 7 794
面向向阳花
面向向阳花 2021-02-05 02:38

On Gitlab, how to compare a file of two different commits? I know that that on command line git, the command is:

git diff commit1 commit12 -- file_name
         


        
7条回答
  •  孤城傲影
    2021-02-05 03:13

    None of the other answers had the correct steps to show a diff between two branches via the Gitlab GUI in its current version. To do so:

    1. Go to your project
    2. Hover over "Repository" in the side-menu and click "Branches"
    3. Next to the branch you wish to compare, click the "Compare" button on the right.
    4. You can then change the target branch from master (or whatever your default branch is called) if you wish.
    5. At the top is commits. Scroll down to see the actual diffs for each modified file.
    6. Scroll to the specific file you want to compare and click to expand if necessary.

提交回复
热议问题