Show Git Log Before Move
Here's how to show the git log for a file, including history before rename.
Git Log
First, the basics:
git log shows the history of changes in the repo.
git log -- ./my-file.clj shows the history of changes to that one file.
git log --pretty='%h - %s - %an' will show a custom-formatted history with the log line including the has, commit message title and author name.
Git Log After Move
When you move a file in git, by default, the log command only shows you the log at the latest file location. Ater that move commit, for instance, you'll only see the move commit:
git log --pretty='%h - %s - %an' -- ./books.clj
a1b2c3d4e5f - BOOK-1024 - move inventory-check modules back into BookDetailView - Jake TrentGit Log Including Before Move
If you want the log to include the tracked changes before the move, you have to follow the move backward in the tree. Add the --follow command, and you'll see the whole history:
git log --pretty='%h - %s - %an' --follow -- ./books.clj
a1b2c3d4e5f - BOOK-1024 - move stock-availability checks back into BookDetailView - Jake Trent
f6e7d8c9b0a - BOOK-1011 - update state.purchaseIntents to support multiple books per order - Jake Trent
c2d3e4f5a6b - BOOK-1021 - change cancel to close button after adding book to cart - Jake Trent
d7e8f9a0b1c - BOOK-1021 - add padding to bottom of book selection screen - Jake Trent
e1f2a3b4c5d - BOOK-1008 - wrap book section heading on mobile to preserve content padding - Jake Trent
a9b8c7d6e5f - BOOK-1008 - flatten orderResult; avoid null in checkout failure case - Jake Trent
b4c5d6e7f8a - BOOK-1008 - clean up checkout state management - Jake Trent
c6d7e8f9a0b - BOOK-1008 - ensure cancel button does not submit book order - Jake Trent
d0a9b8c7e6f - BOOK-1008 - adjust spacing for validation messages in book checkout form - Jake TrentAh, the log history is still there.
There are many other display options for a useful log. `man git-log` then `/PRETTY FORMATS`. ↩