Git Workflow for Python
Objective
Set up a Python project with proper Git workflow and .gitignore.
Tools & Technologies
gitGitHubgitignore
Key Commands
git initgit add .git commit -m 'init'echo '__pycache__/\n*.pyc\nvenv/' > .gitignoreLab Steps
01
Init Repo
Initialize a git repository for a Python project.
02
.gitignore
Create a proper .gitignore for Python: venv, __pycache__, .pyc, .env.
03
Commit Workflow
Stage, commit, and push changes with descriptive messages.
04
Branching
Create feature branches and merge with pull requests.
Challenges Encountered
- Accidentally committing venv or .pyc files
- Merge conflicts in requirements.txt
Key Takeaways
- Never commit secrets — use environment variables or .env files
- Commit often with small, focused changes