Last active
October 29, 2020 03:31
-
-
Save Genzer/da565bb8158780c094623933afd67c53 to your computer and use it in GitHub Desktop.
My attempt to list all git aliases plus colors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# I went through some hard time editing the ~/.gitconfig and finally gave up because | |
# escaping the single-quotes was too hard. | |
# Finally, I left the job to Bash and Git CLI. | |
# Save for future use. | |
# CHANGELOG | |
# v2 | |
# - Change the way to process the alias: replace the first `=` with a `#`. | |
# - Print the alias's command on the next line. | |
git config --global alias.alias \ | |
'!f() { git config -l | grep alias | cut -c 7- | sed "s/=/#/" | awk -F"#" "{ print \"\\033[0;31m\"$1\"\\033[0m\" \" = \"$2 }"; }; f' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment