# => 19 │ 799fa984 │ Update reedline, revert │ Stefan Holderbach │ sholderbach@users.norep │ 3 days ago
# => │ │ crossterm (#4657) │ │ ly.github.com │
# => 20 │ d2bd71d2 │ add LAST_EXIT_CODE │ LordMZTE │ lord@mzte.de │ 3 days ago
# => │ │ variable (#4655) │ │ │
# => 21 │ 11bc0565 │ Find with regex flag │ Fernando Herrera │ fernando.j.herrera@gmai │ 3 days ago
# => │ │ (#4649) │ │ l.com │
# => 22 │ 3eca43c0 │ Plugins without file │ Fernando Herrera │ fernando.j.herrera@gmai │ 3 days ago
# => │ │ (#4650) │ │ l.com │
# => 23 │ ed46f0ea │ fix: add missing │ Jae-Heon Ji │ 32578710+jaeheonji@user │ 3 days ago
# => │ │ metadata for `ls_colors` │ │ s.noreply.github.com │
# => │ │ (#4603) │ │ │
# => 24 │ 0c3ea636 │ Add support for stderr │ Sophia │ 547158+sophiajt@users.nor │ 4 days ago
# => │ │ and exit code (#4647) │ │ eply.github.com │
# => ────┴──────────┴──────────────────────────┴───────────────────┴─────────────────────────┴──────────────
```
Now let's try `group-by` and see what happens. This is a tiny bit tricky because dates are tricky. When you use `group-by` on dates you have to remember to use the `group-by date` subcommand so it's `group-by date date_column_name`.
```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 | format date '%Y-%m-%d'} | group-by date
# => ────────────┬────────────────
# => 2022-03-01 │ [table 3 rows]
# => 2022-02-28 │ [table 8 rows]
# => 2022-02-27 │ [table 8 rows]
# => 2022-02-26 │ [table 5 rows]
# => 2022-02-25 │ [table 1 row]
# => ────────────┴────────────────
```
This would look better if we transpose the data and name the columns
```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 | format date '%Y-%m-%d'} | group-by date | transpose date count
# => ───┬────────────┬────────────────
# => # │ date │ count
# => ───┼────────────┼────────────────
# => 0 │ 2022-03-01 │ [table 3 rows]
# => 1 │ 2022-02-28 │ [table 8 rows]
# => 2 │ 2022-02-27 │ [table 8 rows]
# => 3 │ 2022-02-26 │ [table 5 rows]
# => 4 │ 2022-02-25 │ [table 1 row]
# => ───┴────────────┴────────────────
```
How about `where` now? Show only the records that are less than a year old.
```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} | where ($it.date > ((date now) - 365day))
# => ────┬──────────┬──────────────────────────┬───────────────────┬─────────────────────────┬──────────────
# => # │ commit │ subject │ name │ email │ date
# => ────┼──────────┼──────────────────────────┼───────────────────┼─────────────────────────┼──────────────
# => 0 │ 42f1874a │ Update some examples │ Justin Ma │ hustcer@outlook.com │ 7 hours ago
# => │ │ and docs (#4682) │ │ │
# => 1 │ 2a89936b │ Move to latest stable │ Sophia │ 547158+sophiajt@users.nor │ 8 hours ago
# => │ │ crossterm, with fix │ │ eply.github.com │
# => │ │ (#4684) │ │ │
# => 2 │ ece5e7db │ dataframe list command │ Fernando Herrera │ fernando.j.herrera@gmai │ 8 hours ago
# => │ │ (#4681) │ │ l.com │