Created
February 1, 2024 17:12
-
-
Save austinbrian/c91fa9dbe34ea408fb5f7c6c17a88613 to your computer and use it in GitHub Desktop.
Turn the values of git config into a python dict
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
import subprocess | |
# this should work in any directory, whether a git repo or not | |
git_dict = dict( | |
x.split('=') | |
for x in | |
subprocess.check_output( | |
['git','config','--list'] | |
).decode('ascii').strip().split('\n')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment