From de267250fdb42b4b7f7b3d1179afbb81aed58965 Mon Sep 17 00:00:00 2001 From: Asocia Date: Tue, 4 May 2021 00:59:09 +0300 Subject: [PATCH] TIL: Viewing history of a file --- git/viewing-history-of-a-file.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 git/viewing-history-of-a-file.md diff --git a/git/viewing-history-of-a-file.md b/git/viewing-history-of-a-file.md new file mode 100644 index 0000000..64ced12 --- /dev/null +++ b/git/viewing-history-of-a-file.md @@ -0,0 +1,17 @@ +You can add filename to `git log` to view all the commit history of a file: + +``` +git log my_file +``` + +If you want to view diff's, at `-p` option: +``` +git log -p my_file +``` + +If you want to continue listing the file history beyond renames add `--follow` option: +``` +git log --follow -p my_file +``` + +