📝
This post is part of my “Shorts” series, where each post is concise and hyper-focused on a single concept.
You might have a situation where you create some files in a git repository that is specific to your
workflow. For example, you might create a tags
file that helps you to navigate in the codebase.
Naturally, you do not want to push this file to the remote repository. But, adding this file
to the repository’s .gitignore
leads to your team members unnecessarily knowing about this file.
So, is there a way to maintain a list of files-to-ignore locally?
Git-ignoring a file locally
- Open the file
.git/info/exclude
in your editor. - Treat this file as your personal
.gitignore
. - Add the name of the file you wish to ignore (e.g.,
tags
) to the.git/info/exclude
file.
Further exploration
You can use the following resources to explore further on this topic: