+10

Diff: Make it possible to quickly compare file with another branch/commit

fourier 1 year ago updated by Clément Moyroud 6 months ago 4

Sometimes it is useful to compare the file (modified, staged or non-modified) with its version in another branch or commit:

git diff my-feature1 src/file.copp

This could be added into the context menu when one clicks on a file

Suppose I'm modifying some file on a branch. I want to diff this file against its version on another branch, just quickly check what has been done in the file on another branch comparing to the current state. If I use command line I would just type

git diff other-branch worker.lisp


In SmartGit I want to open the File Compare window instead, via context menu. So what I want is to add some "Compare to branch/revision" button in the Context menu here, which would lead to the dialog allowing me to specify either:

- branch, local/remote (prepopulated dropdown box)

- tag (prepopulated dropdown box)

- commit id (freeform text string).

Upon entering the data the

File Compare view showing changed between a currently selected file and its version on branch/tag/commit should be opened.

Image 747

Agreed, this is very helpful when your local branch is behind the upstream and other developers have added commits on the same file. You're not ready to rebase yet, but you want to understand how the other changes impact yours. It's very easy to do on the command line.

The Show Changes window could be improved so that you can select the reference (on the left or right pane).

If it is about commits, just select the two commits to compare.

No, this is about comparing a locally modified (but uncomitted) file with what's on another branch (typically fetched but not merged remote branches).