Follow

git pro tip:

Add the following lines to ~/.gitignore_global instead of keeping it in a separate .gitignore per project:

.DS_Store
*~
*.bak
*.class

Can you come up with more globally sensible extensions to add? Add them to this thread!

Should this not work for you out-of-the-box, simply run:

git config --global core.excludesfile ~/.gitignore_global

@fribbledom

#python
*.py[oc]
# VIM
*.un~
*.swp
# emacs
*~
\#*
.\#*

Also, for people using Squeak Smalltalk (and Pharo), there should _not_ be *.class in there :D

@fribbledom *.pyc and __pycache__/* for python bytecode files.

.*.swp for vim temporal files

@alexcleac An IMO good solution is to define a vim tmp folder and to store als swp files there instead of the project folder.

@fribbledom Instead of a global ~/.gitignore, you might prefer to create a repository template with a set of patterns in info/exclude; that way you can make exceptions per-project as you need. https://git-scm.com/docs/git-init#_template_directory

@fribbledom if I did this I'd still worry some other idiot would commit those files to the repo instead. 😆

@david

Just don't give write permissions to these people 😆

@fribbledom Why not just keeping the defaut global ~/.gitignore for these paths?

@vinyll @fribbledom or respect XDG:

$XDG_CONFIG_HOME/git/config
$XDG_CONFIG_HOME/git/ignore

@fribbledom what's the tilde rule about? I've not seen that before.

@david

Backup files created by editors like emacs or joe.

@fribbledom ah! Good call.

Seems like a good global list would be made up of files unique to your local setup (like the editor backups) but not those likely to be generated by the project itself (node_modules)

@fribbledom I added
*.orig
because I was always forgetting to remove them after a conflict

@toum @fribbledom

My standard .gitignore in every project. With optional inteliJ config sharing

# ---> Go
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib

# ---> JetBrains
## File-based project format:
*.iws

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Dependency directories
node_modules/
jspm_packages/

# Optional npm cache directory
.npm

# dotenv environment variables file
.env

sample_data
.idea/workspace.xml
.idea/dataSources
.idea/dataSources.local.xml
.idea/httpRequests

@fribbledom

*.sublime-* (Sublime text) *sync-conflict* (Syncthing) .dir-locals.el (Emacs) /GPATH (GNU GLOBAL) /GRTAGS /GTAGS /compile_commands.json (CMake and others) /find_all_symbols_db.yaml (clang-include-fixer)

You can also store these in ${XDG_CONFIG_HOME}/git/ignore (usually ~/.config/git/ignore).

@fribbledom for general inspiration try gitignore.io and use tags for the most common IDEs, languages and OSs to make it create a comprehensive template

@lastfuture @fribbledom In my opinion, IDE specific ignrores belong into the local .git/info/exclude. Every developer might use a different editor and she should care for those IDE files to not be added to the repository.
But on the other hand, a comprehensive list in the .gitignore isn't such a bad idea, either.

@fribbledom what i miss in git is the ability to do reverse ignore, meaning automatically track all new files in a directory

@fribbledom The problem with that is it won't be in the repo for other people.

@fribbledom
not sure where I got these from, but:
cat .config/.gitignore_global
# Backup files
*~

# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite
config/database.yml

@fribbledom
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# RubyMine:
.idea/

public/assets/source_maps

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!