cheatsheets/git-log.md

103 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2015-11-23 00:43:45 +01:00
---
title: git log
2015-11-24 05:30:17 +01:00
category: Git
2015-11-23 00:43:45 +01:00
---
### Revision ranges
2017-10-18 14:44:41 +02:00
```bash
2015-11-23 00:43:45 +01:00
git log master # branch
git log origin/master # branch, remote
git log v1.0.0 # tag
git log master develop
git log v2.0..master # reachable from *master* but not *v2.0*
git log v2.0...master # reachable from *master* and *v2.0*, but not both
```
2017-10-18 14:44:41 +02:00
See [gitrevisions](./git-revisions).
2015-11-23 00:43:45 +01:00
### Basic filters
2017-10-18 14:44:41 +02:00
```bash
-n, --max-count=2
--skip=2
2015-11-23 00:43:45 +01:00
```
2017-10-18 14:44:41 +02:00
```bash
--since="1 week ago"
--until="yesterday"
```
2015-11-23 00:43:45 +01:00
2017-10-18 14:44:41 +02:00
```bash
--author="Rico"
--committer="Rico"
2015-11-23 00:43:45 +01:00
```
### Search
2017-10-18 14:44:41 +02:00
```bash
--grep="Merge pull request" # in commit messages
-S"console.log" # in code
-G"foo.*" # in code (regex)
2015-11-23 00:43:45 +01:00
```
2017-10-18 14:44:41 +02:00
```bash
--invert-grep
--all-match # AND in multi --grep
2015-11-23 00:43:45 +01:00
```
### Limiting
2017-10-18 14:44:41 +02:00
```bash
--merges
--no-merges
2015-11-23 00:43:45 +01:00
```
2017-10-18 14:44:41 +02:00
```bash
--first-parent # no stuff from merged branches
```
2015-11-23 00:43:45 +01:00
2017-10-18 14:44:41 +02:00
```bash
--branches="feature/*"
--tags="v*"
--remotes="origin"
2015-11-23 00:43:45 +01:00
```
### Simplification
2017-10-18 14:44:41 +02:00
```bash
git log -- app/file.rb # only file
--simplify-by-decoration # tags and branches
2015-11-23 00:43:45 +01:00
```
### Ordering
2017-10-18 14:44:41 +02:00
```bash
--date-order
--author-date-order
--topo-order # "smart" ordering
--reverse
2015-11-23 00:43:45 +01:00
```
### Formatting
2017-10-18 14:44:41 +02:00
```bash
--abbrev-commit
--oneline
--graph
2015-11-23 00:43:45 +01:00
```
2017-10-18 14:44:41 +02:00
### Custom formats
```bash
--pretty="format:%H"
2015-11-23 00:43:45 +01:00
```
2017-10-18 14:44:41 +02:00
See: [Git log format cheatsheet](./git-log-format)
## Also see
- [Git log format cheatsheet](./git-log-format)