- edit ~/.gitconfig
cat ~/.gitconfig
[user]
name = Nilesh Patel
email = [email protected]
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
[init]
defaultBranch = main
add following to the end of the file
[user]
name = Nilesh Patel
email = [email protected]
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
[init]
defaultBranch = main
[includeIf "gitdir:~/clients/blanclabs/"]
path = ~/clients/blanclabs/.git-blanclabs.conf
[includeIf "gitdir:~/clients/work"]
path = ~/side-projects/.git-work.conf
- The order is depended, the last one who matches
"wins". - the
/at the end is needed - e.g."gitdir:D:/work"won't work. - the gitdir:
prefixis required.
create a new file .git-blanclabs.conf at ~/clients/blanclabs/ with following contents.
I want to override only email. If you want to override name as well, add it. You can override default branch as well.
[user]
email = [email protected]
[init]
defaultBranch = dev
- cd to ~/clients/blanclabs/
cd ~/clients/blanclabs/ - create a directory:
mkdir test - cd to test
cd test - init git
git init - add a new file
touch aa.txt - add file to staging `git add .```
- commit
git commit -m"first commit" - run git log to see the author `git log```
commit 33db096c6778b36704b03a9b80583e96e5dce7c4 (HEAD -> dev)
Author: Nilesh Patel <[email protected]>
Date: Fri Oct 1 12:56:29 2021 +0530
first commit
(END)
- you can also verify by running
git config -l
credential.helper=osxkeychain
user.name=Nilesh Patel
[email protected]
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
init.defaultbranch=main
includeif.gitdir:~/clients/blanclabs/.path=~/clients/blanclabs/.git-blanclabs.conf
[email protected]
init.defaultbranch=dev