Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git log output like svn ls -v

Tags:

git

svn

Is there a way to make git give me output like svn ls -v does. Basically a list of each file and who last edited that file? Like this:

filea.txt     Someone Else
fileb.txt     Another Person

Maybe even with the SHA to identify the commit the change happened in?

like image 291
Otto Avatar asked Jan 22 '09 05:01

Otto


2 Answers

It's not a very natural question to ask in git, but you can probably achieve something like what you want with something like this.

for a in $(ls); do git log --pretty=format:"%h%x09%an%x09%ad%x09$a" -1 -- "$a"; done

This goes through each file in the current directory and performs a git log on it to find the last commit to have affected it.

It's not very efficient, as it searches the git history for each file and makes no effort to reuse the results of previous searches. It is, however, a one-liner.

like image 188
CB Bailey Avatar answered Sep 17 '22 14:09

CB Bailey


You want to play around with git log and its pretty formats. Here's an example that doesn't completely address what you want, but should get you on the way:

git log --pretty=format:"%h: %s -- %an"

Prints:

...
58a2e46: Added readme for github. -- DylanFM
...
like image 28
dylanfm Avatar answered Sep 19 '22 14:09

dylanfm