Skip to content

Instantly share code, notes, and snippets.

@Moarram
Moarram / git-status-counts.zsh
Last active March 2, 2025 18:37
A Zsh function to get the quantity of each Git status, in the form of an associative array
#!/bin/zsh
git-status-counts() {
local -A counts=(
'STAGED' 0 # staged changes
'CHANGED' 0 # unstaged changes
'UNTRACKED' 0 # untracked files
'BEHIND' 0 # commits behind
'AHEAD' 0 # commits ahead
'DIVERGED' 0 # commits diverged