Last active
February 20, 2026 14:21
-
-
Save atheiman/f5aa05aec2dd4bea9d8382c7f9d5bb44 to your computer and use it in GitHub Desktop.
gitconfig showing some common options I use
This file contains hidden or 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
| [user] | |
| name = John Doe | |
| email = john.doe@example.com | |
| username = jdoe01 | |
| [alias] | |
| co = checkout | |
| br = branch | |
| st = status | |
| # Show cloned repo local path. `cd $(git root)` is useful from inside large projects. | |
| root = !pwd | |
| # Show origin default branch. | |
| default-branch = !git symbolic-ref refs/remotes/origin/HEAD | cut -f4- -d/ | |
| # Switch to default branch, and pull from origin. Useful after youre done with a feature branch to reset | |
| # on the default branch. | |
| pull-default-branch = !git co $(git default-branch) && git pull origin $(git default-branch) | |
| [init] | |
| defaultBranch = main | |
| [http "https://git.example.com] | |
| # Example configuring git to connect to internal git server with internally signed certificate. | |
| # Get cert body with `openssl s_client -connect git.example.com:443 -showcerts < /dev/null` | |
| sslCAInfo = C:/Users/jdoe01/example-com-internal-ca-cert.pem | |
| # Include other gitconfig based on cloned repo local path. I use this to set corporate email addresses, etc | |
| [includeIf "gitdir:~/code/git.example.corp/"] | |
| path = ~/.gitconfig-example-corp | |
| [includeIf "gitdir:~/code/gist.github.com/"] | |
| path = ~/.gitconfig-github | |
| [includeIf "gitdir:~/code/github.com/"] | |
| path = ~/.gitconfig-github |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment