Menu

.gitignore Isn’t the Only Way To Ignore Files in Git
📰
583

.gitignore Isn’t the Only Way To Ignore Files in Git

Reading 0:00
15s threshold

I’ve been using Git for so long and I just realized you can ignore files at three different levels and not just with .gitignore . The three files you can use to ignore files are: .gitignore .git/info/exclude ~/.config/git/ignore .gitignore is the usual file where you write files you want to ignore. It’s checked into Git along with the rest of the code. Whatever files you add to it will not get taken into account when running git commands. .git/info/exclude The exclude file lives in the .git directory of every Git repository but changes to it are not checked into Git. It usually has a few comment lines on a fresh Git repository. This file is useful for ignoring things on a per-repo basis. For example, you may have a personal notes.txt file in a repository that you don’t want to check into git but you also don’t want to add to .gitignore because it’s unique to your workflow. In that case you would add notes.txt to .git/info/exclude .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More