There are many code management and version control tools are available out there. Among all the Git is a famous and mostly used version control tool in the world. When developers commit the code to any repository it is recommended to ignore the unnecessary files and folders in the repository.
Sometimes, we need to add files and folders to the git ignore files to prevent them from uploading to the repository and sharing with all. We need to ignore files such as some user-related files, visual studio-related files, bin/release files, packages, and so on. This writeup explains the different ways to add git ignore files and folders using the Git Desktop application.
- Github Desktop
Method 1- Manually adding folders and files to gitigonre file
Open Github Desktop and go to your desired repository where you need to add files/folders to the git ignore and commit the code. Then, right-click on File and add it to git ignore as depicted. Your file will be added to the git ignore.
Method 2 – Modify GitIgnore File Manually
Open and edit the gitIgnore file from the local folder location and add all files that you want to ignore and save it.
Method 3-From Repository Setting
Open the GitHub desktop and go to the Repository tab as illustrated below.
You will get below screen where you have to go to Ignored files.
Then write the folder or file that you want to add in the git ignore file as depicted below and click Save.
Hence, this write-up has described how you can add and ignore files/folders in git using different ways. I hope you will find it useful to add your unnecessary file and folder to the gitignore and commit your code.