---
title: "What is .gitignore and what should I put in it?"  
description: "What is .gitignore and what should I put in it?"  
author: "Davide Romano"  
published: 2026-11-16  
updated: 2026-11-16  
canonical: https://www.mindstick.com/forum/163047/what-is-gitignore-and-what-should-i-put-in-it  
category: "Git and DevOps"  
tags: ["git", "gitignore", "repository", "Version Control", "best practices"]  
reading_time: 1 minute  

---

# What is .gitignore and what should I put in it?

My repository has bin and obj folders and even a config file with passwords. How do I keep those out?

## Replies

### Reply by Ayesha Cheema

A `.gitignore` file lists patterns of files and folders that Git should not track. Put it in the repository root.

Usually ignored:

- **Build output:** `bin/`, `obj/`, `dist/`, `build/`
- **Dependencies:** `node_modules/`, `packages/`, `.venv/`
- **IDE and OS files:** `.vs/`, `.idea/`, `.DS_Store`, `Thumbs.db`
- **Logs and temporary files:** `*.log`, `*.tmp`
- **Secrets and local settings:** `.env`, `appsettings.Development.json` (if it holds secrets), `*.pfx`

Do not start from a blank file. GitHub's gitignore templates (for example the "VisualStudio" one) cover most cases.

Important: .gitignore only affects files that are **not yet tracked**. If a file was already committed, run `git rm --cached path/to/file` and commit. If it contained a password, rotating that password is essential, because the secret remains in the old history.


---

Original Source: https://www.mindstick.com/forum/163047/what-is-gitignore-and-what-should-i-put-in-it

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
