# Ignoring Files

Certain projects may include private files (like secrets) or downloaded content (like dependencies). Such files may contain very sensitive information or very large amounts of data and they should not be included in ANY snapshots of the project.

This is where ignoring files with `.gitignore` comes into play.

## Using .gitignore

To start, let's create a new file `secrets.txt`:

```
touch secrets.txt
```

If you run `git status`, you will notice that Git prompts you to stage `secrets.txt`. But we don't want that to happen. So we can add a file `.gitignore` and add the path to `secrets.txt`:

```
echo "secrets.txt" >> .gitignore
```

Then, when you run `git status` again, you will notice that Git no longer prompts you to stage `secrets.txt`. Wonderful!

## Predefined .gitignore

You can find a set of predefined `.gitignore` files here: <https://github.com/github/gitignore>

We highly recommend going with them for any project so that you are not redefining/missing any common files and folders that should be ignored.

When creating a repository on Github, can select a predefined `.gitignore` to be added in the repository so you can save a step of adding the file

<figure><img src="/files/8GRZrvznjtcC6Lea9hzB" alt=""><figcaption></figcaption></figure>

## What to ignore?

Typically, we ignore files like build artifacts and generated files that are usually derived from the human-authored code in the repository.

* Dependency caches like `/node_modules`
* Compiled code like `.o`, `.pyc` files
* Build output directories like `/bin`, `/out`
* Runtime-generated files like log files
* Personal configuration files e.g. of your IDE

## Further reading on ignoring files on git

* <https://git-scm.com/docs/gitignore>
* <https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.nushackers.org/orbital/git/advanced-concepts/ignoring-files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
