"The Git Commands I Run Before Reading Any Code" (piechowski.io)
from eager_eagle@lemmy.world to programming@programming.dev on 09 Apr 22:23
https://lemmy.world/post/45403288

#programming

threaded - newest

pageflight@piefed.social on 09 Apr 23:02 next collapse

Gonna have to try that out. I think it would have told interesting stories on some past repos.

I wish ‘’co-authored by AI’ was easy to flag in vcs.

olafurp@lemmy.world on 11 Apr 20:18 collapse

This is going into my bashrc as a mini cli. I’m pretty sure I’m going to want to run this every time I change jobs.

xSikes@feddit.online on 10 Apr 00:48 next collapse

Super cool

aivoton@sopuli.xyz on 11 Apr 14:51 next collapse

Ahh the famous git commands such as sort, uniq, head, and grep.

87Six@lemmy.zip on 11 Apr 15:58 next collapse

This would have no effect in my team where everyone does whatever they want in git lol

Kissaki@programming.dev on 12 Apr 07:56 collapse

They’re bash/shell- and bin-dependent commands rather than Git commands. I use Nushell.
Transformed to Nushell commands:

  • The 20 most-changed files in the last year:
    git log --format=format: --name-only --since=“1 year ago” | lines | str trim | where (is-not-empty) | uniq --count | sort-by count --reverse | take 20
  • Who Built This:
    git shortlog -sn --no-merges
    git shortlog -sn --no-merges --since="6 months ago"
  • Where Do Bugs Cluster:
    git log -i -E --grep=“fix|bug|broken” --name-only --format=‘’ | lines | str trim | where (is-not-empty) | uniq --count | sort-by count --reverse | take 20
  • Is This Project Accelerating or Dying:
    git log --format=‘%ad’ --date=format:‘%Y-%m’ | lines | str trim | where (is-not-empty) | uniq --count
  • How Often Is the Team Firefighting:
    git log --oneline --since=“1 year ago” | find --ignore-case --regex ‘revert|hotfix|emergency|rollback’

/edit: Looks like the lines have whitespace or sth. Replaced lines --skip-empty with lines | str trim | where (is-not-empty).

command aliases

nu def “gits most-changed-files” [] { git log --format=format: --name-only --since=“1 year ago” | lines | str trim | where (is-not-empty) | uniq --count | sort-by count --reverse | take 20 } def “gits who” [] { git shortlog -sn --no-merges } def “gits who6m” [] { git shortlog -sn --no-merges --since=“6 months ago” } def “gits fixes” [] { git log -i -E --grep=“fix|bug|broken” --name-only --format=‘’ | lines | str trim | where (is-not-empty) | uniq --count | sort-by count --reverse | take 20 } def “gits aliveness” [] { git log --format=‘%ad’ --date=format:‘%Y-%m’ | lines | str trim | where (is-not-empty) | uniq --count } def “gits firefighting” [] { git log --oneline --since=“1 year ago” | find --ignore-case --regex ‘revert|hotfix|emergency|rollback’ }