The Git Commands I Run Before Reading Any Code

submitted by

piechowski.io/post/git-commands-before-reading-…

1
34

Log in to comment

1 Comments

The codebase audit link at the bottom is also a really good read!


Comments from other communities

That’s pretty good except one giant flaw. The author relies on counting commits. That doesn’t work in a lot of places, I prefer squashing commits when merging a PR/MR to reduce the back and forth noise, so you will find me in position 5 or 6 in the projects I am the top expert of. I don’t think git blame and counting number of lines would help either, because if we change our formatting standard and ask the junior to reformat the projects and make sure they continue working, he they will show up as top expert in something they know nothing about.

These commands make you feel good but tell nothing about the project and who are the experts.

.git-blame-ignore-revs



Why are there posts for how to open a tab in vim

Out of all the things I’ve done in vim, I’ve never opened a tab. I didn’t even know that was a thing, and I’ve been using it off and on since… 2009? (increasingly so over the years).



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.

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.



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



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 --skip-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 --skip-empty | uniq --count | sort-by count --reverse | take 20
  • Is This Project Accelerating or Dying:
    git log --format='%ad' --date=format:'%Y-%m' | lines --skip-empty | uniq --count
  • How Often Is the Team Firefighting:
    git log --oneline --since="1 year ago" | find --ignore-case --regex 'revert|hotfix|emergency|rollback'

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


Insert image