Keep Junk Out of Your Repo
68%
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)
.envLearn Git in a Day
Everything you need, nothing you don'tEnroll now to unlock all content and receive all future updates for free.
Unlock now $9.99$7.49Learn More
Hurry! This limited time offer ends in:
To redeem this offer, copy the coupon code below and apply it at checkout:
