news.volyx.in

.gitignore Isn't the only way to ignore files in Git (nelson.cloud)

600 points by FergusArgyll · 24 days ago · 176 comments on HN

Article summary

The article discusses the different ways to ignore files in Git, beyond just using the .gitignore file. It highlights three files that can be used to ignore files: .gitignore, .git/info/exclude, and ~/.config/git/ignore. Each file has a different scope, with .gitignore being checked into Git, .git/info/exclude being specific to a repository, and ~/.config/git/ignore being global. The article also provides a command to check which file is ignoring a specific file.

Main themes

  • Git ignore files
  • Git configuration
  • Version control
  • File management
  • Git workflows

What commenters say

  • The article is a low-effort regurgitation of existing Git documentation.
  • The article provides useful complementary advice, such as the use of the 'check-ignore' command.
  • Git is a complex and versatile tool that can be difficult to master.
  • Using .git/info/exclude is a useful way to ignore files on a per-repo basis.
  • Some users prefer to version control their dotfiles and configuration files using Git.
  • There are different approaches to managing dotfiles and configuration files, such as using GNU Stow or storing them in a separate repository.
  • Some users find it useful to create a directory, such as 'attic' or '.local', to store files that should not be committed to Git.
  • Git does not automatically exclude all files starting with a dot.