git visual diff between branches

前端 未结 16 1944
独厮守ぢ
独厮守ぢ 2020-12-12 08:35

This answer is great for seeing a visual diff between two files that are checked into git: How do I view 'git diff' output with a visual diff program?

Howev

相关标签:
16条回答
  • 2020-12-12 09:14

    Try "difftool" (assuming you have diff tools setup) - see https://www.kernel.org/pub/software/scm/git/docs/git-difftool.html

    I find name status good for the summary but difftool will iterate the changes (and the -d option gives you the directory view), e.g.

    $ git difftool their-branch my-branch
    
    Viewing: 'file1.txt'
    Launch 'bc3' [Y/n]:
    ...
    

    Or as @rsilva4 mentioned with -d and default to your current branch it is just - e.g. compare to master:

    $  git difftool -d master..
    

    ...and yes - there are many variations - https://www.kernel.org/pub/software/scm/git/docs/git-reset.html

    0 讨论(0)
  • 2020-12-12 09:15

    If you use the excellent WebStorm editor, you can compare with any branch you'd like:

    0 讨论(0)
  • 2020-12-12 09:16

    You can also use vscode to compare branches using extension CodeLense, this is already answered in this SO: How to compare different branches on Visual studio code

    0 讨论(0)
  • 2020-12-12 09:18

    If you are using OSX or Windows 7+, Atlassian SourceTree works very well for this. It is free.

    You can see staged changes in a side-by-side diff setup, and you easily compare local with remote and any other two branches. When multiple files are selected, the diff shows up as below:

    enter image description here

    Assuming you have checked out a feature branch and you want to see the diff against 'master', right-click on the 'master' branch and select "Diff against current"

    Unfortunately, it doesn't seem as if it will be available on *nix distributions anytime soon.

    0 讨论(0)
  • 2020-12-12 09:23

    Use git diff with a range.

    git diff branch1..branch2
    

    This will compare the tips of each branch.

    If you really want some GUI software, you can try something like SourceTree which supports Mac OS X and Windows.

    0 讨论(0)
  • 2020-12-12 09:23

    If you're using github you can use the website for this:

    github.com/url/to/your/repo/compare/SHA_of_tip_of_one_branch...SHA_of_tip_of_another_branch

    That will show you a compare of the two.

    0 讨论(0)
提交回复
热议问题