#git Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
Bash Most-Modified Files in Repo
Find the hottest files in a git history — useful for spotting hotspots that need refactoring or extra test coverage.
Bash Clean Up Merged Branches
Delete every local branch that's been merged to main. Filters out main/master and the current branch as a safety net.
Bash Find Commit That Introduced a String
`git log -S` (the "pickaxe") finds commits whose diff added or removed a given string. The fastest way to answer "when did this line first appear?"
Bash List Authors by Commit Count
Quick repo stats: who has done what. Add --no-merges if you don't want to count merge commits.
Bash Stash With a Message
`git stash` without args is hard to grep through later. Always pass a message — your future self will thank you.
Bash Show Current Branch in Prompt
Append the git branch to your bash prompt. Survives non-git dirs gracefully (just shows nothing). Drop into ~/.bashrc.
Bash Squash Last N Commits
Combine the last N commits into one before merging a feature branch. Avoids hours of "WIP" / "fix typo" commits cluttering history.
Bash Reset Branch to Match Remote
Throw away local commits and resync to origin. Destructive — make sure no local work is at risk first.