As other answers mentioned, git config -l
lists all your configuration details from your config file. Here's a partial example of that output for my configuration:
...
alias.force=push -f
alias.wd=diff --color-words
alias.shove=push -f
alias.gitignore=!git ls-files -i --exclude-from=.gitignore | xargs git rm --cached
alias.branches=!git remote show origin | grep \w*\s*(new^|tracked) -E
core.repositoryformatversion=0
core.filemode=false
core.bare=false
...
So we can grep out the alias lines, using git config -l | grep alias
:
alias.force=push -f
alias.wd=diff --color-words
alias.shove=push -f
alias.gitignore=!git ls-files -i --exclude-from=.gitignore | xargs git rm --cached
alias.branches=!git remote show origin | grep \w*\s*(new^|tracked) -E
We can make this prettier by just cut
ting out the alias.
part of each line, leaving us with this command:
git config -l | grep alias | cut -c 7-
Which prints:
force=push -f
wd=diff --color-words
shove=push -f
gitignore=!git ls-files -i --exclude-from=.gitignore | xargs git rm --cached
branches=!git remote show origin | grep \w*\s*(new^|tracked) -E
Lastly, don't forget to add this as an alias:
git config --global alias.la "!git config -l | grep alias | cut -c 7-"
Enjoy!