Skip to content

Commit 5b7c67a

Browse files
committed
TIL Git: See all changes to a file
Given a file eg `app/models/user.rb`, you can easily see all the commits made in this file: ```shell $ git log app/models/user.rb ``` If you want to who wrote which line of code in the current file, you can: ```shell $ git blame app/models/user.rb ``` If you want to see all the lines that are written in the file (including deleted and modified lines), you can: ```shell $ git log -L ,:app/models/user.rb ``` Now you can really find out who write what code when. :)
1 parent 8590a8e commit 5b7c67a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

git/see-all-changes-to-a-file.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See all changes to a file
2+
3+
Given a file eg `app/models/user.rb`, you can easily see all the commits made in this file:
4+
5+
```shell
6+
$ git log app/models/user.rb
7+
```
8+
9+
If you want to who wrote which line of code in the current file, you can:
10+
11+
```shell
12+
$ git blame app/models/user.rb
13+
```
14+
15+
If you want to see all the lines that are written in the file (including deleted and modified lines), you can:
16+
17+
```shell
18+
$ git log -L ,:app/models/user.rb
19+
```
20+
21+
Now you can really find out who write what code when. :)

0 commit comments

Comments
 (0)