How to ignore new files or folders without .gitignore

There’s a simple way to ignore files/folders to stop showing up in your git status. Please remember these are the “new” files and folders that we will ignore from git and not the files/folders that have already been added and are existing in your git repo.

Add them in the .git/info/exclude file.

Let’s exclude a file random.txt which is in your root folder where you have the .git file, without using .gitignore.

Open .git/info/exclude and enter random.txt

Now, let’s exclude a sub_folder.

Open .git/info/exclude and enter sub_folder_name.

And that’s how we can use .git/info/exclude file for ignoring in git.

That’s all for today!

Happy Git-ing!

Leave a comment

Your email address will not be published. Required fields are marked *