git显示由我或文件夹中的任何人提交的最近10次提交所做的更改作为整合更改 [英] git show changes done by last 10 commits by me or anyone in a folder as a consolidated change

查看:114
本文介绍了git显示由我或文件夹中的任何人提交的最近10次提交所做的更改作为整合更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

引用我的

这是该问题的延续
我有一个git仓库,其中有一个文件夹。在此文件夹中,多人进行更改。

在一次提交中,我添加了几行代码,在接下来的提交中,我删除了这些行。

让我们把这些行称为X.



我想:


  1. 查看我在该目录的最近10次提交中完成的所有更改(即,仅由我完成的更改)作为统一更改,并将文件中的所有更改视为单个空间。

    Ie for me我不应该看到这些行 X ,并且应该看到每个文件只有一次 - b $ b和


  2. 查看在最近10次提交中任何人在该目录中所做的所有更改,作为统一更改,我将文件中的所有更改视为单个空间。

    对于我,我不应该看到那些第X行,并应该看到每个文件只有一次

  3. href =http://git-scm.com/docs/git-diff =nofollow noreferrer> git diff
    更适合于先前建议的 git log 然后:

      git diff @〜10 @  - 路径/到/文件夹

    git diff HEAD〜10 HEAD - 路径/ to / folder

    (带 @ HEAD 的快捷键,git 1.8.4 + p>

    注意:正确地 try-catch-finally 指出,这对于作者无效:作者可以在提交级别过滤,而不是在补丁级别过滤。

    这就是为什么我对前一个问题的回答使用了 git log --author = xxx -p



    但要获得修补程序尽管如此,git diff仍然是正确的工具。

    Reference to my original question

    This is in continuation of that question I have a git repository in which I have a folder. In this folder multiple people makes changes. I have recently made few commits in that directory .

    In one commit I added few lines of code and in next commit I removed those lines.
    Lets call these lines as X.

    I want to:

    1. view all changes that I have done in last 10 commits in that directory (ie changes done by me only) as a consolidated change where I see all changes in a file as a single space.
      Ie for me I should not see those lines X and should see each file single time only
      and

    2. view all changes that anyone has done in that directory in last 10 commits as a consolidated change where i see all changes in a file as a single space.
      Ie for me I should not see those lines X and should see each file single time only

    解决方案

    A git diff is more suited than the previously suggested git log then:

    git diff @~10 @  -- path/to/folder
    or
    git diff HEAD~10 HEAD  -- path/to/folder
    

    (with @ being a shortcut for HEAD, git 1.8.4+)

    Note: as try-catch-finally rightly points out, this won't work regarding author: authorship can be filtered at the commit level, not so much at the patch level.
    That is why my answer to the previous question used git log --author=xxx -p.

    But to get the patches in one consolidated result though, git diff remains the right tool.

    这篇关于git显示由我或文件夹中的任何人提交的最近10次提交所做的更改作为整合更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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