git show changes done by last 10 commits by me or anyone in a folder as a consolidated change

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 .

  • Choose author credentials for git repositories based on some subdirectory
  • Git prevents pushing after amending a commit
  • How to export URLs in org-mode to ascii without brackets
  • non fast-forward update in Git
  • Migrating Clearcase to X
  • What's the best way to force a merge in git?
  • 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

  • Git: Switch between forks, and create pull-request back
  • Pushing to Git returning Error Code 403 fatal: HTTP request failed
  • Sync Branch and staying up to date with a project using GitHub for Windows
  • How do I find back a commit in Git?
  • Netbeans showing no local branches when trying to push to git repo
  • Pycharm django configuration removed on git pull
  • 2 Solutions collect form web for “git show changes done by last 10 commits by me or anyone in a folder as a consolidated change”

    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.

    If you have one commit that adds files and another commit that removes them, you may want to consider interactive rebasing to squash those two commits together which will effectively remove the ‘inconsistent state commit’ that you probably want to eliminate.

    Bring up the interactive rebasng editor with:

    $ git rebase -i HEAD~10
    

    Note that “~” in HEAD~10 is a ‘squiggly’ not a dash !

    More info at http://git-scm.com/book/en/Git-Tools-Rewriting-History

    Git Baby is a git and github fan, let's start git clone.