til/git/viewing-history-of-a-file.md

18 lines
313 B
Markdown
Raw Normal View History

2021-05-03 23:59:09 +02:00
You can add filename to `git log` to view all the commit history of a file:
```bash
2021-05-03 23:59:09 +02:00
git log my_file
```
2021-05-04 00:02:29 +02:00
If you want to view diff's, add `-p` option:
```bash
2021-05-03 23:59:09 +02:00
git log -p my_file
```
2021-05-04 00:02:29 +02:00
If you want to continue listing the file history beyond renames, add `--follow` option:
```bash
2021-05-03 23:59:09 +02:00
git log --follow -p my_file
```