Skip to content

Commit ff7f5f0

Browse files
committed
Merge pull request #5 from futureworkz/git-see-all-changes
TIL Git: See all changes to a file
2 parents a406dad + 5b7c67a commit ff7f5f0

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)