Introduction

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.

Prerequisites

  • 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.

After that when you commit your code the ignored files/folder will not be committed to the repository.

Conclusion

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.

One thought on “Adding Git Ignore File and Folder Using Git Desktop”
  1. Thanks for the marvelous posting! I really enjoyed reading
    it, you could be a great author.I will remember to
    bookmark your blog and will often come back later in life.
    I want to encourage you continue your great job, have a nice afternoon!

Leave a Reply

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