Git log: summarize the movement of directories containing many files

I am doing a directory level reorganization in my repository. The resulting commits show a lot of file-level renaming, which hides the fact that conceptually all I did was one or two teams git mv dir1/ dir2/.

Is there a way to git logsummarize this kind of operation to show that conceptually the entire directory has been moved? I thought --dirstat, or --summarizeI at least will bring, but they do not seem to do what I want.

(I understand that the git repository model does not track any information about directories, only files. However, the same applies to renaming files, but it can output file-level renaming information after the fact.)

Here is a simple example:

#setup
git init
mkdir dir1
for f in foo bar baz; do echo $f > dir1/$f; done
git add dir1
git commit -m 'dir1'

#do the directory move
git mv dir1 dir2
git commit -m 'rename dir1 to dir2'

- :

$ git log -1 --what-options-go-here?
b0ba9c9 rename dir1 to dir2
0       0       {dir1 => dir2}/

:

$ git log -1 --numstat --oneline
b0ba9c9 rename dir1 to dir2
0       0       {dir1 => dir2}/bar
0       0       {dir1 => dir2}/baz
0       0       {dir1 => dir2}/foo
+4
1

Git ( " ", . diff -M, -B -C). c1 c2 path1 c1, path2 c2, " ". path2 path1, (, , , -M 100%).

, " ", :

  • dir1 ( )
  • dir2 ( ( )
  • , "" dir1 , dir1 dir2 ,

, dir1 dir2. ( "" dir2.)

, " ". , git . (, , , , , .) , , ; , , .

+1

All Articles