git-log: update

This commit is contained in:
Rico Sta. Cruz 2017-10-18 20:44:41 +08:00
parent f7ebbb129d
commit 10a9f3cda6
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
2 changed files with 58 additions and 34 deletions

View File

@ -108,3 +108,7 @@ See the next tables on format variables.
| `%cr` | committer date (relative) | | `%cr` | committer date (relative) |
| `%ct` | committer date (unix timestamp) | | `%ct` | committer date (unix timestamp) |
| `%ci` | committer date (iso8601) | | `%ci` | committer date (iso8601) |
## Also see
- [Git log cheatsheet](./git-log)

View File

@ -1,12 +1,12 @@
--- ---
title: git log title: git log
category: Git category: Git
layout: 2017/sheet
--- ---
### Revision ranges ### Revision ranges
See [gitrevisions](git-revisions.html).
``` ```bash
git log master # branch git log master # branch
git log origin/master # branch, remote git log origin/master # branch, remote
git log v1.0.0 # tag git log v1.0.0 # tag
@ -17,67 +17,87 @@ 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 git log v2.0...master # reachable from *master* and *v2.0*, but not both
``` ```
See [gitrevisions](./git-revisions).
### Basic filters ### Basic filters
```bash
-n, --max-count=2
--skip=2
``` ```
git log
-n, --max-count=2
--skip=2
--since="1 week ago" ```bash
--until="yesterday" --since="1 week ago"
--until="yesterday"
```
--author="Rico" ```bash
--committer="Rico" --author="Rico"
--committer="Rico"
``` ```
### Search ### Search
```bash
--grep="Merge pull request" # in commit messages
-S"console.log" # in code
-G"foo.*" # in code (regex)
``` ```
git log
--grep="Merge pull request" # in commit messages
-S"console.log" # in code
-G"foo.*" # in code (regex)
--invert-grep ```bash
--all-match # AND in multi --grep --invert-grep
--all-match # AND in multi --grep
``` ```
### Limiting ### Limiting
```bash
--merges
--no-merges
``` ```
git log
--merges
--no-merges
--first-parent # no stuff from merged branches ```bash
--first-parent # no stuff from merged branches
```
--branches="feature/*" ```bash
--tags="v*" --branches="feature/*"
--remotes="origin" --tags="v*"
--remotes="origin"
``` ```
### Simplification ### Simplification
``` ```bash
git log -- app/file.rb # only file git log -- app/file.rb # only file
--simplify-by-decoration # tags and branches --simplify-by-decoration # tags and branches
``` ```
### Ordering ### Ordering
``` ```bash
--date-order --date-order
--author-date-order --author-date-order
--topo-order # "smart" ordering --topo-order # "smart" ordering
--reverse --reverse
``` ```
### Formatting ### Formatting
```bash
--abbrev-commit
--oneline
--graph
``` ```
--pretty="..." # see man git-log / PRETTY FORMATS
--abbrev-commit ### Custom formats
--oneline
--graph ```bash
--pretty="format:%H"
``` ```
See: [Git log format cheatsheet](./git-log-format)
## Also see
- [Git log format cheatsheet](./git-log-format)