Show diff between commits

前端 未结 11 1990
闹比i
闹比i 2020-12-02 04:00

I am using Git on Ubuntu 10.04 (Lucid Lynx).

I have made some commits to my master.

However, I want to get the difference between these commits. All of

相关标签:
11条回答
  • 2020-12-02 04:20

    I use gitk to see the difference:

    gitk k73ud..dj374
    

    It has a GUI mode so that reviewing is easier.

    0 讨论(0)
  • 2020-12-02 04:22

    Use this command for the difference between commit and unstaged:

    git difftool --dir-diff
    
    0 讨论(0)
  • 2020-12-02 04:26

    Simplest for checking the changes in the last 2 commits after pull:

    git diff HEAD~2 
    
    0 讨论(0)
  • 2020-12-02 04:28

    To see the difference between two different commits (let's call them a and b), use

    git diff a..b
    
    • Note that the difference between a and b is opposite from b and a.

    To see the difference between your last commit and not yet committed changes, use

    git diff
    

    If you want to be able to come back to the difference later, you can save it in a file.

    git diff a..b > ../project.diff
    
    0 讨论(0)
  • 2020-12-02 04:30
    1. gitk --all
    2. Select the first commit
    3. Right click on the other, then diff selected → this
    0 讨论(0)
  • 2020-12-02 04:33

    Let's say you have one more commit at the bottom (oldest), then this becomes pretty easy:

    commit dj374
    made changes
    
    commit y4746
    made changes
    
    commit k73ud
    made changes
    
    commit oldestCommit
    made changes
    

    Now, using below will easily server the purpose.

    git diff k73ud oldestCommit
    
    0 讨论(0)
提交回复
热议问题