How To Find File History With Git And Visual Studio Code

Pavol Kutaj
2 min readOct 13, 2021

The concern is documenting reading through the history of changes of a file using git. As I deal with both clients and colleagues who make frequent changes to config files, I quickly need to see the timeline of changes per file.

1. VS Code Timeline feature — easiest view of file history

  • In VS Code, run the command
Explorer: Focus on Timeline View
  • Shortcut: CTRL + SHIFT + P → Enter Timeline → Select Explorer: Focus on Timeline View

2. VS Code Open in Github Extension

3. git log -p

  • this is not git diff
  • run git pull → fetch & merge potential merges
  • run git log -p <filename> → see what has been changed

4. file history: who & commit message

git log --pretty=format:"%C(auto)%h%d%Creset %C(cyan)(%ci)%Creset %C(green)%cn <%ce>%Creset %s" --name-status --date=short --all --full-history -- _FILENAME_

--

--

Pavol Kutaj

Today I Learnt | Infrastructure Support Engineer at snowplow.io with a passion for cloud infrastructure/terraform/python/docs. More at https://pavol.kutaj.com