How do I see the commit differences between branches in git?

后端 未结 10 971
太阳男子
太阳男子 2020-12-04 04:13

I\'m on branch-X and have added a couple more commits on top of it. I want to see all the differences between MASTER and the branch that I am on in terms of commits. I could

10条回答
  •  猫巷女王i
    2020-12-04 05:13

    I think it is matter of choice and context.I prefer to use

    git log origin/master..origin/develop --oneline --no-merges
    

    It will display commits in develop which are not in master branch.

    If you want to see which files are actually modified use

    git diff --stat origin/master..origin/develop --no-merges
    

    If you don't specify arguments it will display the full diff. If you want to see visual diff, install meld on linux, or WinMerge on windows. Make sure they are the default difftools .Then use something like

    git difftool -y origin/master..origin/develop --no-merges
    

    In case you want to compare it with current branch. It is more convenient to use HEAD instead of branch name like use:

    git fetch
    git log origin/master..HEAD --oneline --no-merges
    

    It will show you all the commits, about to be merged

提交回复
热议问题