Rullst AcademyRullst Academy/Lesson
Git: every change counts · Lesson 05 / 10

Choose what stays out

Projects also contain temporary files and private data. Selection must happen before the first commit.

Learning paths12 min

Let's discover together

  1. 1

    Create .gitignore as plain text containing .env, *.tmp and /scratch/, one pattern per line. It tells Git to ignore matching files that are not yet tracked.

  2. 2

    For the test, create .env containing only DEMO=example, with no real credentials. git status --short --ignored -- .env shows !!. The file remains on disk; ignoring neither deletes nor encrypts.

  3. 3

    If notes.txt is already committed, adding its name to .gitignore does not untrack it or remove historical copies. In scenario 2, editing it still appears as M.

  4. 4

    Review status and diff --staged before commits and uploads. If a real secret was published, ignoring or reverting cannot make it secret again: revoke/rotate the credential and follow the provider exposure procedure. Here we only use fictional content.

GIT · .md

Your change laboratory

This page’s experiments show prepared outputs. To run real commands, use a new practice folder on your computer and the guide included in “Download activity”. Read the instructions before each command.

My files and GitHub

The editor below saves your Markdown notes in this browser. Download a copy to take them to another device. Sending that file to GitHub does not send your computer’s .git history.

FROM LESSON TO PRACTICE

A guide to follow at your pace

Read the steps before using the reference below. Commands run in the indicated system’s terminal; signup happens on the official site. Rullst Academy exercises are practice and do not verify your installation or external account.

git status --short --ignored -- .env
git add .gitignore
git diff --staged
git commit -m "Ignore local scratch files"

Official links and next step

✦
YOUR MISSION

Use .gitignore and recognise its limits for tracked files.

Now it's your turn

Discovery workshop

Read the state, choose the next step

These are two separate examples: .env is new and matches a .gitignore rule; notes.txt was already committed when its rule was added and was later edited. Both are fictional. Predict which stops appearing in ordinary status. Prepared outputs.
Mini experiment

Learning simulation: compare cards and check your predictions. The browser is not compiling Rust or starting a server.

git status --short --ignored -- .env
Build your answers and check when you are ready.
A moment to understand

Does adding a committed file to .gitignore remove its history?

I need a hint

.gitignore selects untracked files; it is not a secret-removal tool.

Loading your journey…

Take it with you

Inspect .env with the read-only command and commit only .gitignore. Then create a fictional .tmp and explain why normal status omits it.

At your own pace

My files and GitHub

Every lesson can become your own record: code, notes or a practice plan. Saving a file to GitHub is optional and does not change your XP.

Student guide

The editor and downloads open when this lesson is available to your account. Check access below or return to the track map.

Checking your access to this lesson…

Rullstpetbot

AI can make mistakes. Check the lesson material.