OSDN Git Service

Regular updates
[twpd/master.git] / git-log.md
1 ---
2 title: git log
3 category: Git
4 layout: 2017/sheet
5 ---
6
7 ### Revision ranges
8
9 ```bash
10 git log master             # branch
11 git log origin/master      # branch, remote
12 git log v1.0.0             # tag
13
14 git log master develop
15
16 git log v2.0..master       # reachable from *master* but not *v2.0*
17 git log v2.0...master      # reachable from *master* and *v2.0*, but not both
18 ```
19
20 See [gitrevisions](./git-revisions).
21
22 ### Basic filters
23
24 ```bash
25 -n, --max-count=2
26     --skip=2
27 ```
28
29 ```bash
30     --since="1 week ago"
31     --until="yesterday"
32 ```
33
34 ```bash
35     --author="Rico"
36     --committer="Rico"
37 ```
38
39 ### Search
40
41 ```bash
42     --grep="Merge pull request"   # in commit messages
43     -S"console.log"               # in code
44     -G"foo.*"                     # in code (regex)
45 ```
46
47 ```bash
48     --invert-grep
49     --all-match                   # AND in multi --grep
50 ```
51
52 ### Limiting
53
54 ```bash
55     --merges
56     --no-merges
57 ```
58
59 ```bash
60     --first-parent          # no stuff from merged branches
61 ```
62
63 ```bash
64     --branches="feature/*"
65     --tags="v*"
66     --remotes="origin"
67 ```
68
69 ### Simplification
70
71 ```bash
72 git log -- app/file.rb          # only file
73     --simplify-by-decoration    # tags and branches
74 ```
75
76 ### Ordering
77
78 ```bash
79     --date-order
80     --author-date-order
81     --topo-order              # "smart" ordering
82     --reverse
83 ```
84
85 ### Formatting
86
87 ```bash
88     --abbrev-commit
89     --oneline
90     --graph
91 ```
92
93 ### Custom formats
94
95 ```bash
96     --pretty="format:%H"
97 ```
98
99 See: [Git log format cheatsheet](./git-log-format)
100
101 ## Also see
102
103 - [Git log format cheatsheet](./git-log-format)