Skip to main content
/1 min read

Ignore Files with .gitignore

Git vs GitHub

FeatureDescription
GitLocal version control system — runs on your machine, tracks file history.
GitHubCloud platform that hosts Git repositories — adds PRs, issues, collaboration.
Build Programming Foundations at Noble Desktop

Noble Desktop's Full-Stack Web Development Certificate teaches Git alongside the modern web stack — a must for any developer.

There will be some files that you don't want Git to track. You can use a.gitignore file to list the files and/or folders that Git should ignore.

Create a Git Ignore File

1. Using your code editor, save an empty file named .gitignore into the based (root) folder of your Git repo.

NOTE: On Unix-based operating systems such as macOS, files that start with a period (.) are hidden, so you will not see the .gitignore file in the macOS Finder unless you show hidden files. You should be able to see it in most code editors.

2. In this file you list any files you want to ignore. Here's an example of some files everyone would probably want to ignore:

# Mac.DS_Store.DocumentRevisions-V100.Spotlight-V100.Trashes

# Windows Thumbs.db

Syntax For.gitignore

To learn about the syntax for this file, refer to:

  • Git-scm.com/docs/gitignore
  • Atlassian.com/Git/tutorials/saving-changes/gitignore

Go Beyond Git

We offer the best coding courses and bootcamps for students at all levels of experience. Classes are hands-on and students receive workbooks with step-by-step instructions through exercises with real-world applications. Check out our programming courses now: