Skip to content

Conversation

@heyodai
Copy link

@heyodai heyodai commented Dec 6, 2023

Reasons for making this change:

As a Python developer, I always manually add .DS_Store to .gitignore in my projects. These files are created by macOS to store folder attributes: https://en.wikipedia.org/wiki/.DS_Store

These files are not relevant to the project's codebase and can clutter the repo if committed. I think it makes sense for .DS_Store exclusion to be the default.

Links to documentation supporting these rule changes:

  • The .gitignore documentation from Git supports the idea of excluding system-specific files which are not relevant to the project: https://git-scm.com/docs/gitignore
  • Stack Overflow discussions on the topic, such as this thread which highlights the common practice of ignoring .DS_Store in git repos.

@hspaans
Copy link
Contributor

hspaans commented Dec 15, 2023

The gitignore repository is split into a section of templates that you can use for specific languages and/or frameworks and should be in your repository. The second section of templates are for global usage like setting them for a user of the system as they're working on Windows or MacOS for example. Putting the content in $XDG_CONFIG_HOME/git/ignore will enable filtering for all git repositories in use by that user as that is default location.

You can also choose to use $HOME/.gitignore for example, but then this location has to be enabled with the command below:

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

People who are using GitHub Codespaces or Devcontainers for example the .gitignore and .gitconfig files can also be set in <username>/dotfiles repository so it will be part of every environment created.

Hopefully this helps to improve your experience with git and gitignore without extra modifications.

@heyodai
Copy link
Author

heyodai commented Dec 15, 2023

Thank you, @hspaans. I actually wasn't aware of these options. I'll look into them.

However, these workarounds have to be configured. New Mac users won't know about them and will end up committing the .DS_Store file at least some of the time.

Unless there are legitimate situations where a .DS_Store file should be included in a repo, I don't see any reason not to have it be part of the default .gitignore. It's similar to .venv in this sense.

@Sil-P
Copy link

Sil-P commented Feb 2, 2024

It's similar to .venv in this sense.

Not really, .venv is python-specific.

Maybe consider this suggestion instead: #4401 (comment)

@wirecat
Copy link
Collaborator

wirecat commented May 28, 2024

Thank you for contributing, but we don't accept OS specific rules in template files unless they're added to the OS specific template in Global.

See macOS.gitignore for an example.
🙇

@wirecat wirecat closed this May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants