How can I find all commits that are in one branch but not in another using git?

前端 未结 3 1473
再見小時候
再見小時候 2021-01-31 09:30

I\'ve two branches, master and live. Master is the development branch and contains commits that aren\'t ready to go into live.

    <
相关标签:
3条回答
  • 2021-01-31 10:12

    I ended up solving my own problem using a short python script combining git patch-id and git log, the script can be found here https://gist.github.com/4565584

    0 讨论(0)
  • 2021-01-31 10:13

    You are very close. The correct command is:

    git log --cherry-pick --oneline --no-merges --left-only master...live
    

    from the log manpage:

    --left-only, --right-only

    List only commits on the respective side of a symmetric range, i.e. only those which would be marked < resp. > by --left-right.

    For example, --cherry-pick --right-only A...B omits those commits from B which are in A or are patch-equivalent to a commit in A. In other words, this lists the + commits from git cherry A B. More precisely, --cherry-pick --right-only --no-merges gives the exact list.

    0 讨论(0)
  • 2021-01-31 10:18

    git log master ^live --no-merges

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