GITIGNORE File What It Is and How to Open One
GITIGNORE File (What It Is and How to Open One) GA S REGULAR Menu Lifewire Tech for Humans Newsletter! Search Close GO Software & Apps > File Types
.DS_Store?
._* .Trashes
ehthumbs.db
Thumbs.db Here's a GITIGNORE example that excludes LOG, SQL, and SQLITE files from the source code: *.log
*.sql
*.sqlite There are lots of pattern rules that must be followed in order to abide by the proper syntax rules that Git demands. You can read about these, and a lot more about how the file works, from the official GITIGNORE Documentation website. Make sure to remember that if you've already checked in a file to not be ignored, and then later add an ignore rule for it in the GITIGNORE file, Git will not ignore the file until you untrack it with the following command: git rm --cached nameofthefile
What Is a GITIGNORE File?
How to open, edit, and convert GITIGNORE files
By Tim Fisher Tim Fisher Senior Vice President & Group General Manager, Tech & Sustainability Emporia State University Tim Fisher has more than 30 years' of professional technology experience. He's been writing about tech for more than two decades and serves as the VP and General Manager of Lifewire. lifewire's editorial guidelines Updated on September 2, 2021 Tweet Share Email Tweet Share EmailIn This Article
Expand Jump to a Section What Is a GITIGNORE File How to Open How to Convert Advanced Reading Extra: File Still Not Opening? Frequently Asked Questions A file with the GITIGNORE file extension is a Git Ignore file used with the version/source control system called Git.What Is a GITIGNORE File
A Git Ignore file specifies which files and folders should be ignored in a given source code. It can be used on a per-path basis so that the rules are only applied to specific folders, but you can also create a global GITIGNORE file that applies to every Git repository you have. You can find dozens of examples of GITIGNORE files that are recommended in various scenarios, from GitHub's .gitignore templates page.How to Open a GITIGNORE File
GITIGNORE files are plain text files, meaning you can open one with any program that can read text files. Windows users can open GITIGNORE files with the built-in Notepad program or with the free Notepad++ application. To open GITIGNORE files on macOS, you can use Gedit. Linux users (as well as Windows and macOS) might find Atom useful for opening and editing GITIGNORE files. However, GITIGNORE files are not actually usable (i.e. they don't function as an ignore file) unless they're utilized within the context of Git, which is free software that runs on Windows, Linux, and macOS. You can use the GITIGNORE file by placing it wherever it is that you want the rules to apply. Put a different one in each working directory and the ignore rules will work for each folder individually. If you put the GITIGNORE file in the root folder of the project's working directory, you can add all the rules there so that it takes on a global role. Do not put the GITIGNORE file in the Git repository directory; that will not allow the rules to apply since the file needs to be in the working directory. GITIGNORE files are useful for sharing the ignore rules with anyone else who might clone your repository. This is why, according to GitHub, it's important to commit it into your repository.How to Convert To From a GITIGNORE File
See this Stack Overflow thread for information on converting CVSIGNORE to GITIGNORE. The simple answer is that there isn't a regular file converter that can do it for you, but there might be a script you can use to copy over the patterns of the CVSIGNORE file. See How to Convert SVN Repositories to Git Repositories for help doing that. Also, see this Bash script that might be able to achieve the same thing. To save your GITIGNORE file to a text file format, use one of the text editors mentioned above. Most of them can convert to TXT, HTML, and similar plain text formats.Advanced Reading on GITIGNORE Files
You can build a local GITIGNORE file from Terminal, with this command: touch .gitignore A global one can be made like this: git config --global core.excludesfile ~/.gitignore_global Alternatively, if you don't want to make a GITIGNORE file, you can add exclusions to your local repository by editing the .git/info/exclude file. Here's a simple example of a GITIGNORE file that would ignore various files generated by the operating system: .DS_Store.DS_Store?
._* .Trashes
ehthumbs.db
Thumbs.db Here's a GITIGNORE example that excludes LOG, SQL, and SQLITE files from the source code: *.log
*.sql
*.sqlite There are lots of pattern rules that must be followed in order to abide by the proper syntax rules that Git demands. You can read about these, and a lot more about how the file works, from the official GITIGNORE Documentation website. Make sure to remember that if you've already checked in a file to not be ignored, and then later add an ignore rule for it in the GITIGNORE file, Git will not ignore the file until you untrack it with the following command: git rm --cached nameofthefile