git diff仅显示提交修订/分支A在修订/分支B之前 [英] git diff showing only commits that revision/branch A is ahead of revision/branch B

查看:176
本文介绍了git diff仅显示提交修订/分支A在修订/分支B之前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我遇到以下问题:


  1. 在功能分支中添加一些提交。


  2. 从上游更新主设备。

  3. 想要查看功能分支和主设备之间的差异,但 git diff master 显示在master中添加/删除的所有东西,当我真的只想看到功能分支在主控之前的提交,而不是那些它是




  4. 有没有办法做到这一点,而不必将主人合并到功能分支?

    解决方案

    我认为正确的答案是三重点

      git diff master ...特性

    。另请参阅: git diff - 仅显示新增内容远程


    Sometimes I have the following problem:

    1. Add some commits in a feature branch.

    2. Update master from upstream.

    3. Want to see the diff between the feature branch and master, but git diff master shows all of the things that have been added/removed in master, when I really only want to see the commits that the feature branch is ahead of master, not the ones that it's behind.

    Is there a way to do this without having to merge master into the feature branch?

    解决方案

    I think the right answer is triple dot

    git diff master...feature
    

    That shows only new changes on feature with respect to master. See also: git diff - show only what's new on the remote

    这篇关于git diff仅显示提交修订/分支A在修订/分支B之前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆