Common Default Configurations for Git#
article/done/published#
Tools#
View Git Configuration#
git config [--local|--global|--system] -l
Common Settings#
![[Default to rebasing and automatically stash saving when pulling code]]
Default Submodule Summary Display#
git config --global status.submodulesummary true
Default Check if All Submodules Have Been Pushed#
git config --global push.recursesubmodules check
Line Endings#
Convert to LF on commit, convert to CRLF on checkout#
git config --global core.autocrlf true
Reject files with mixed line endings on commit#
git config --global core.safecrlf true
Color Configuration#
git config --global color.branch auto
git config --global color.diff auto
git config --global color.interactive auto
git config --global color.status auto
git config --global color.ui true
Git Aliases#
# git status ==> git s
git config --global alias.s status
# git diff ==> git d
git config --global alias.d diff
# git checkout ==> git co
git config --global alias.co checkout
# git branch ==> git br
git config --global alias.br branch
# git pull --rebase ==> git pr
git config --global alias.pr "pull --rebase"
# git add . ==> git a
git config --global alias.a "add ."
# git commit -m ==> git cm
git config --global alias.cm "commit -m"
# git reset --hard ==> git rh
git config --global alias.rh "reset --hard"
# git reset --hard HEAD ==>git rhH
git config --global alias.rh "reset --hard HEAD"
Set an Alias for Git, Use 'g' Instead of 'git'#
echo "alias g=git" >> ~/.bash_profile
Now you can directly use 'g s' to check the status instead of 'git status'.
# git status
g s