Skip to content

Instantly share code, notes, and snippets.

@akaralar
Created March 8, 2024 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akaralar/fb1a4472b2aac3c096057e2f6310a6b2 to your computer and use it in GitHub Desktop.
Save akaralar/fb1a4472b2aac3c096057e2f6310a6b2 to your computer and use it in GitHub Desktop.
Sort gitconfig file
# taken from https://blog.wotw.pro/sort-git-config/
# the options for each property need to be indented using a single tab beforehand...
cat ~/.config/git/config | sed 's/ +/\t/g' | awk -F '\t' '$1 { current = $1; print current } $2 { print current "\t" $2}' | sort | awk -F '\t' '!$2 {print $1} $1 && $2 { print "\t" $2 }' | pbcopy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment