Committing Your ML Project
Duration: 5 min
Organizing Your Project
A well-organized project makes it easier to collaborate and maintain. Create folders for code, data, and models.
# Create project structure
mkdir -p my-ai-project/{data,models,notebooks}
cd my-ai-project
# Create files
echo 'print("ML Model")' > train.py
echo 'data/' > .gitignore
echo 'models/' >> .gitignore
# Check status
git statusOn branch main
Untracked files:
(use "git add <file>..." to add the file)
.gitignore
train.py
nothing added to commit but untracked files present (tracking)Committing Your Work
# Stage all changes
git add .
# Commit with a descriptive message
git commit -m 'Add ML model training script'
# Push to GitHub
git push origin main[main 1a2b3c4] Add ML model training script
2 files changed, 5 insertions(+)
create mode 100644 .gitignore
create mode 100644 train.pyWhat is .gitignore?
The .gitignore file tells Git which files to ignore. You should ignore large data files, model files, and temporary files to keep your repository clean.
💡 Tip: Common things to ignore: data/, models/, pycache/, .env, *.pyc
❓ What should you put in .gitignore?