How To Find File History With Git And Visual Studio Code
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
- Use Open in GitHub — Visual Studio Marketplace
- Shortcut: CTRL + SHIFT + P → Enter File History → Select Open in Github: File History
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_