This Git repository contains basic and recommended Git configurations in addition to useful web URLs.
At least every user should configure her/his name and a commit email address. These settings can be configured globally with the --global
parameter and will be saved in the user's root directory (~/.gitconfig
):
git config --global user.name "firstname lastname"
git config --global user.email [email protected]
The recommendation for an additional configuration includes:
- Global gitignore file (gitignore)
- Commit message template (gitmessage)
- Default branch changed to
main
(from 'master') (requires Git 2.28+) - Simple push (only push current branch)
- Recursive submodule init
The basic and recommended settings are provided in the file gitconfig-recommendations. Please change the user settings if the content is copied.
Some additional settings are included in the gitconfig-complete configuration template (like aliases and color settings).
The global configurations are a user-specific settings found in the user home directory (~/
) (or in the User folder for Windows, e.g. C:\Users\<YourName>
)
- Copy either gitconfig-recommendations or gitconfig-complete to
~/.gitconfig
(or~/.config/git/config
) - Replace username and commit email address in
~/.gitconfig
(or~/.config/git/config
) directly or via git config commands - Copy gitignore to
~/.gitignore
- Copy gitmessage to
~/.gitmessage
Git basics:
- Git cheat sheet: Git Cheat Sheet (from GitHub)
- Git Introduction: Git: The Beginner's Guide to Understanding Core Version Control Concepts
- Git Basics: Free Git book
Best practices:
- Git ignore: Git ignore recommendations
- Commit Messages: Git commit message best practices