Home Explore Blog CI



nushell

5th chunk of `cookbook/parsing_git_log.md`
21902c678afac2edf984ded92a1af319dfd7c63eb8329c5d000000010000123a
# =>     │          │ (#4668)                  │                   │                           │
# =>  11 │ 796d4920 │ add char separators      │ Darren Schroeder  │ 343840+fdncred@users.no   │ 2 days ago
# =>     │          │ (#4667)                  │                   │ reply.github.com          │
# =>  12 │ 0f437589 │ add last exit code to    │ Darren Schroeder  │ 343840+fdncred@users.no   │ 2 days ago
# =>     │          │ starship parameters      │                   │ reply.github.com          │
# =>     │          │ (#4670)                  │                   │                           │
# =>  13 │ ef70c8db │ Date parse refactor      │ Jonathan Moore    │ jtm170330@utdallas.edu    │ 2 days ago
# =>     │          │ (#4661)                  │                   │                           │
# =>  14 │ 10364c4f │ don't use table          │ Sophia            │ 547158+sophiajt@users.nor │ a day ago
# =>     │          │ compaction in to nuon if │                   │ eply.github.com           │
# =>     │          │ not a table (#4671)      │                   │                           │
# =>  15 │ eec17304 │ Add profiling build      │ Stefan Holderbach │ sholderbach@users.norep   │ a day ago
# =>     │          │ profile and symbol strip │                   │ ly.github.com             │
# =>     │          │ (#4630)                  │                   │                           │
# =>  16 │ d6a6c4b0 │ Add back in default      │ Sophia            │ 547158+sophiajt@users.nor │ a day ago
# =>     │          │ keybindings (#4673)      │                   │ eply.github.com           │
# =>  17 │ 0924975b │ Use default_config.nu    │ Sophia            │ 547158+sophiajt@users.nor │ a day ago
# =>     │          │ by default (#4675)       │                   │ eply.github.com           │
# =>  18 │ b09acdb7 │ Fix unsupported type     │ Justin Ma         │ hustcer@outlook.com       │ a day ago
# =>     │          │ message for some math    │                   │                           │
# =>     │          │ related commands (#4672) │                   │                           │
# =>  19 │ cb5c61d2 │ Fix open ended ranges    │ Sophia            │ 547158+sophiajt@users.nor │ a day ago
# =>     │          │ (#4677)                  │                   │ eply.github.com           │
# =>  20 │ e3100e6a │ Fix alias in             │ Luca Trevisani    │ lucatrv@hotmail.com       │ a day ago
# =>     │          │ `docs/sample_config/con  │                   │                           │
# =>     │          │ fig.toml`                │                   │                           │
# =>     │          │ (#4669)                  │                   │                           │
# =>  21 │ a6a96b29 │ Add binary literals      │ Sophia            │ 547158+sophiajt@users.nor │ 20 hours ago
# =>     │          │ (#4680)                  │                   │ eply.github.com           │
# =>  22 │ ece5e7db │ dataframe list command   │ Fernando Herrera  │ fernando.j.herrera@gmai   │ 8 hours ago
# =>     │          │ (#4681)                  │                   │ l.com                     │
# =>  23 │ 2a89936b │ Move to latest stable    │ Sophia            │ 547158+sophiajt@users.nor │ 8 hours ago
# =>     │          │ crossterm, with fix      │                   │ eply.github.com           │
# =>     │          │ (#4684)                  │                   │                           │
# =>  24 │ 42f1874a │ Update some examples     │ Justin Ma         │ hustcer@outlook.com       │ 7 hours ago
# =>     │          │ and docs (#4682)         │                   │                           │
# => ────┴──────────┴──────────────────────────┴───────────────────┴───────────────────────────┴──────────────
```

That's neat but what if I want it sorted in the opposite order? Try the `reverse` command and notice the newest commits are at the top.

```nu
git log --pretty=%h»¦«%s»¦«%aN»¦«%aE»¦«%aD -n 25 | lines | split column "»¦«" commit subject name email date | upsert date {|d| $d.date | into datetime} | sort-by date | reverse

Title: Reversing Sorted Git Log Output in Nushell
Summary
This snippet extends the previous example by demonstrating how to reverse the order of the sorted git log entries. It takes the output from the `sort-by date` command and pipes it into the `reverse` command, resulting in the newest commits appearing at the top of the output.