Created
March 12, 2020 15:36
-
-
Save samredai/bf31394aa5cd825a428d2b301971aead to your computer and use it in GitHub Desktop.
Git: Get all commit diffs for a single file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Retrieve all commit hashes that include the particular file | |
git log -p path/to/target/file/filename.py | grep -n "^commit" | grep -Eo "[^ ]+$" > ~/commit_hashes.txt | |
# Loop through and perform a git diff on each hash | |
while read line; do git diff $line; done < ~/commit_hashes.txt > commit_diffs.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment