Git log to show a user's modified files sorted by type

git log examples
git log format
git log --author
git log show files
git log commit id
git log --oneline
git log --grep
git log branch

For some reports at work, I have to send files I have modified this month, grouped by type. I've been working on a git log command to show the filenames and status, but it would help me if I could get it to sort by file extension as well. Working from this answer I have gotten to: git log --no-merges --author="me" --after={2019-03-31} --name-status --pretty=format:"" | sort -u

Now I'm stumped on how to sort this list by filename.

This is the current output, but usually with tens of files:

M   package.json
M   src/app/spa/components/component1/comp1-tpl.html
M   src/app/spa/components/component1/comp1-component.ts
M   src/app/spa/components/component1/comp1-services.ts
M   src/app/spa/components/component1/comp1-services.spec.ts
A   src/app/spa/components/component2/comp2-tpl.html

By "filename", if you mean the path:

git log --no-merges --author="me" --after={2019-03-31} --name-status --pretty=format:"" | sort -k2

If you mean the name without any parent directories:

git log --no-merges --author="me" --after={2019-03-31} --name-status --pretty=format:"" | while read type path;do echo "$(basename $path) $type    $path";done | sort -u | cut -f2- -d' '

Viewing the Commit History, This works for both git log and gitk - the 2 most common ways of viewing history. You don't need to use the whole name: git log --author="Jon". How to show your Git username 1) The `git config` command Here’s the git config command: git config user.name which in my case returns: Alvin 2) The `git config --list` command Another way to show your Git username is with this git config command: git config 3) Look in your Git configuration

I have a idea. Add "grep .ext" in the following of command. For the result redirect a output in file. Then do the same thing for other extension. At the end, you obtain the totally files ordered by the extension. Do you understand my idea ? For your example report.txt containt a ordered list.

-> git log --no-merges --author="me" --after={2019-03-31} --name-status --pretty=format:"" | sort -u | grep "\.html" >> report.txt

-> git log --no-merges --author="me" --after={2019-03-31} --name-status --pretty=format:"" | sort -u | grep "\.json" >> report.txt

-> git log --no-merges --author="me" --after={2019-03-31} --name-status --pretty=format:"" | sort -u | grep "\.ts" >> report.txt

How can I view a git log of just one user's commits?, If you don't like the default git log format, you can use git config 's aliasing The --decorate flag makes git log display all of the references (e.g., branches, tags,� If false, git log and related commands will not treat the initial commit as a big creation event. Any root commits in git log -p output would be shown without a diff attached. The default is true. log.showSignature . If true, git log and related commands will act as if the --show-signature option was passed to them. mailmap.* See git-shortlog[1].

You could prepend the extension before sorting like this:

> git log --no-merges --author="me" --after={2019-03-31} --name-status --pretty=format:"" | sed -r 's|.*(\.[^.]+)$|\1\t&|;' | sort -u
.html   A   src/app/spa/components/component2/comp2-tpl.html
.html   M   src/app/spa/components/component1/comp1-tpl.html
.json   M   package.json
.ts     M   src/app/spa/components/component1/comp1-component.ts
.ts     M   src/app/spa/components/component1/comp1-services.spec.ts
.ts     M   src/app/spa/components/component1/comp1-services.ts

Advanced Git Log, The two most common ways of viewing history are git log and gitk - t. You don't even have to write your whole name. For instance, putting only� The most basic filtering option for git log is to limit the number of commits that are displayed. When you’re only interested in the last few commits, this saves you the trouble of viewing all the commits in a page. You can limit git log’s output by including the -<n> option. For example, the following command will display only the 3 most

How can I view a git log of just one user's commits?, We can use git log command in order to list, filter, view commit history in different ways. In this tutorial we will examine git log command usage in� Git log is a very important command in this course and your Git learning journey. Git log helps you see the past commits which help to see who did what in Git and the repository. It helps you track the changes happened in your repository. Mix the options with the commands to explore more in the Git log. We will head on to our next tutorial.

How To List Commit History with Git Log Command with Examples , each commit's: Secure Hash Algorithm (SHA); author; date; commit message git log --oneline. The --oneline flag causes git log to display. The one-page guide to git log: usage, examples, links, snippets, and more. Devhints.io Edit; git log cheatsheet. Revision ranges git log master # branch git log origin/master # branch, remote git log v1.0.0 # tag git log master develop git log v2.0..maste

Git Log Command Explained, Command: git log --pretty=raw. The raw log output format shows the entire commit exactly as stored in the commit object. commit <sha-1> The first part of the git show command that has been marked in the image is similar to the git log command but points towards the HEAD. There is also a second part to the output that command gave us: This part is called the diff. Although it would not be correct to define this here as it will be discussed in detail in Git Diff tutorial.

Comments
  • First one is almost exactly what I needed, but I still get duplicates (from files modified in multiple commits). If you can just add a | sort -u or | uniq to the end, I will mark this as the accepted answer.
  • @VitorM.Barbosa try sort -u | sort -k2. If you want a path to occur only once no matter what status it is, use sort -k2 -u instead.
  • Makes sense, this will work fine when I have only a few file extensions, but it will be slower with more.
  • Good, thanks! For my fellow Mac users, if you get this error: sed: illegal option -- r, it can be solved with brew install gnu-sed and then changing the command to use gsed.