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

后端 未结 10 969
太阳男子
太阳男子 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条回答
  •  半阙折子戏
    2020-12-04 05:14

    #! /bin/bash
    if ((2==$#)); then
      a=$1
      b=$2
      alog=$(echo $a | tr '/' '-').log
      blog=$(echo $b | tr '/' '-').log
      git log --oneline $a > $alog
      git log --oneline $b > $blog
      diff $alog $blog
    fi
    

    Contributing this because it allows a and b logs to be diff'ed visually, side by side, if you have a visual diff tool. Replace diff command at end with command to start visual diff tool.

提交回复
热议问题