Feedback

Chat Icon

Learn Git in a Day

Everything you need, nothing you don't

Keep Junk Out of Your Repo
60%

Write Your First .gitignore

Let's see the problem first. Run your calculator to generate a __pycache__ folder:

python3 calculator.py

Now check the status:

git status

Git will show __pycache__/ as an untracked file. We don't want to commit it. Let's create a .gitignore file to tell Git to ignore it - along with other files we'll never want to track:

cat << 'EOF' > .gitignore
# Compiled Python files
__pycache__/
*.pyc

# Virtual environment
venv/

# Environment variables (secrets)
.env

Learn Git in a Day

Everything you need, nothing you don't

Enroll now to unlock all content and receive all future updates for free.