Skip to content

Instantly share code, notes, and snippets.

@iturgeon
Last active May 25, 2017 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iturgeon/417ff0a464dd65e928338d14c34bfe44 to your computer and use it in GitHub Desktop.
Save iturgeon/417ff0a464dd65e928338d14c34bfe44 to your computer and use it in GitHub Desktop.
Recommended git settings

Best Practices for Configuring Git CLI

  1. Use your actual name. Your git history is valuable evidince of your skills and experience.
  2. Use an email address that'll last. You may not be that proud of 1337SquirtleSquad@yahoo.com in a few years.
  3. If you don't know how to quit vi, change your default git editor
  4. Create a global gitignore to make sure you don't commit needless, massive, or dangerous files to any repo.
  5. Set colors (color.ui) to auto if possible. Git will automatically remove color info when piping into another output

Global Git Config

Settings in your global git config can be found via git config --global --list. They are saved in ~/.gitconfig. Poke around, investigate what options are availible and what you've got them set to.

Global Git Ignore

This gist includes a good example gitignore for a starting point. Keep in mind, anything you add to this ignore will not show up in git status and git add will require a force flag.

  1. Create a global git ignore file in your home directory `touch ~/.gitignore
  2. Copy the rules from the example gitignore into that file
  3. Tell git to use your ignore file git config --global core.excludesfile ~/.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc
# Temporary files #
###################
*.swp
*.swo
*~
# Packages #
############
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files #
######################
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment