On Gitlab, how to compare a file of two different

2019-06-26 04:08发布

问题:

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

what is the link format to do this on gitlab?

see my related question

回答1:

It will compare commits, You will be able to find file in list.

1) go to Repository > Compare
2) paste: https://gitlab.com/$USER/$REPO/compare?from=$SHA1&to=$SHA2 url
3) hit enter (notice: gitlab will set 'Source' and 'Target' properly)
4) click button 'compare'



回答2:

I can compare files within commits by doing the following:

Repository -> Commits

Select the desired Branch and Commit

This results in a side by side comparison of all changes across all files. Just below the commit message is this statement (yours will obviously be differ)

Showing 18 changed files with 209 additions and 68 deletions

The 18 changed files is a dropdown menu with a list of all changed files. Select the file you want to compare. This will reduce the list to just the file of interest.



标签: git gitlab