This post is about a git learning I had some time ago. The codebase that I was hired to work on had diverged from the main branch at some point in the past (months earlier). A few months into the project I took on the responsibility of merging the diverged branches together. It took me a really long time (hours) to finish, but all seemed to go well.
The problem: after doing the merge we kept working and making further commits, but then needed to get a diff of the files in the merge commit.
The solution: git show. I found the commit hash of the merge and then executed
git show --stat COMMIT_HASH.
Here's some sample output:
git show --stat 76e4db39e5a344dd2353e68b6 commit 76e4db39e5a344dd2353e68b6f8e67fc745568a6 Merge: 7b8965f 327dfe4 Author: Master Bennett <email@example.com> Date: Mon May 29 00:48:30 2017 -0400 Merge branch 'ob-pages' # Conflicts: # _config.yml .gitignore | 1 + _site/404.html | 2 +- _site/about/index.html | 2 +- _site/archives/index.html | 18 +- .../index.html | 4 +- _site/articles/android/index.html | 2 +- .../apple-gcc-4.2-and-amarok-beginning/index.html | 11 +- _site/articles/baby-stuff/index.html | 2 +- _site/articles/building-a-better-zombie/index.html | 8 +- _site/articles/bundling-fool-too/index.html | 8 +- _site/atom.xml | 196 +++++++++++---------- _site/css/font-awesome.css.map | 7 + _site/index.html | 2 +- _site/page2/index.html | 2 +- _site/page3/index.html | 2 +- _site/page4/index.html | 2 +- _site/page5/index.html | 2 +- _site/page6/index.html | 2 +- _site/page7/index.html | 2 +- _site/page8/index.html | 2 +- _site/page9/index.html | 2 +- _site/sitemap.xml | 6 +-
--stat flag was a quick and dirty way to see whether there were additions and deletions to a file, or whether just the permissions were changing. That was a critical piece of information that saved us a LOOOOOT of time on something that was very time sensitive.
Knowing that allowed me to ignore files which only had permissions change and narrow the search down to those files which actually had substantial changes. So here's to git, it's one of the good ones.