How to ignore new files or folders without .gitignore

Ignore new files 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
random.txt

Now, let’s exclude a sub_folder.

# Open .git/info/exclude and enter sub_folder_name
sub_folder_name

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

That’s all for today!

Happy Git-ing!

Author: Admin

Hello Friends, welcome to Hackerdays.com. I am the Admin of the site. I have worked as a software programmer for 7 years. I have started this site to learn as well as share whatever little knowledge i have gained over the period of time. If you wish to contact me, you can drop in an email to: admin[AT]hackerdays[DOT]com or you can also use the contact page. Thank you and I'll see you around.

Let us know your thoughts: