
TIL about git configs
Hear ye hear ye people who write git config
user.email
<your-email> && git config
user.name
<your-name>
everytime you spin up or clone a repository.
I’m embarrassed to admit I just found out about how easy having a ~/.gitconfig
is and how it’ll save me 4 seconds a few times a week. I legitimately had bash aliases for this…
alias gcud='git config user.name "Brian Via" && git config user.email "<my work email>"'
alias gcup='git config user.name "Brian Via" && git config user.email "<my personal dev email>"' # good ol' g-cup
Insert joke about how long to automate vs how much time it saves. But in the era of AI, this stuff is one prompt and one exit of vim from being your reality in under a minute.
Credit to Randall at xkcd.
My new setup to avoid that
Here’s my gitconfig setup below:
~/.gitconfig
:
[user]
name = Brian Via
email = [email protected] # default email address for me
[includeIf "gitdir:~/Development/Dfinitiv/"] # my work project subfolder
path = ~/.gitconfig-work
[includeIf "gitdir:~/Development/Personal/"] # my personal projects subfolder
path = ~/.gitconfig-personal
~/.gitconfig-work
:
[user]
email = [email protected]
~/.gitconfig-personal
:
[user]
email = [email protected]
11 years into this biz and apparently I’m stupid enough to not know about things like this.
I’m also stupid enough to write a blog post about it. Later nerds.
Helpful Diagram I Found
Who knew about this stuff?!