diff --git a/git-log-format.md b/git-log-format.md index 6328bf92f..b1491f5f0 100644 --- a/git-log-format.md +++ b/git-log-format.md @@ -108,3 +108,7 @@ See the next tables on format variables. | `%cr` | committer date (relative) | | `%ct` | committer date (unix timestamp) | | `%ci` | committer date (iso8601) | + +## Also see + +- [Git log cheatsheet](./git-log) diff --git a/git-log.md b/git-log.md index 4b7e12a44..9612d104a 100644 --- a/git-log.md +++ b/git-log.md @@ -1,12 +1,12 @@ --- title: git log category: Git +layout: 2017/sheet --- ### Revision ranges -See [gitrevisions](git-revisions.html). -``` +```bash git log master # branch git log origin/master # branch, remote 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 ``` +See [gitrevisions](./git-revisions). + ### Basic filters +```bash +-n, --max-count=2 + --skip=2 ``` -git log - -n, --max-count=2 - --skip=2 - --since="1 week ago" - --until="yesterday" +```bash + --since="1 week ago" + --until="yesterday" +``` - --author="Rico" - --committer="Rico" +```bash + --author="Rico" + --committer="Rico" ``` ### 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 - --all-match # AND in multi --grep +```bash + --invert-grep + --all-match # AND in multi --grep ``` ### 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/*" - --tags="v*" - --remotes="origin" +```bash + --branches="feature/*" + --tags="v*" + --remotes="origin" ``` ### Simplification -``` -git log -- app/file.rb # only file - --simplify-by-decoration # tags and branches +```bash +git log -- app/file.rb # only file + --simplify-by-decoration # tags and branches ``` ### Ordering -``` - --date-order - --author-date-order - --topo-order # "smart" ordering - --reverse +```bash + --date-order + --author-date-order + --topo-order # "smart" ordering + --reverse ``` ### Formatting +```bash + --abbrev-commit + --oneline + --graph ``` - --pretty="..." # see man git-log / PRETTY FORMATS - --abbrev-commit - --oneline - --graph + +### Custom formats + +```bash + --pretty="format:%H" ``` + +See: [Git log format cheatsheet](./git-log-format) + +## Also see + +- [Git log format cheatsheet](./git-log-format)