IntermediatePythonEngineering
Git and GitHub for Engineers
Version simulation scripts and calculation notebooks without losing work or overwriting colleagues.
Estimated completion: 40 min

Objective
Set up a repository, branch safely and review changes for an engineering codebase.
Required knowledge
- Command line basics
Software and tools
- Git
- A GitHub account
Files and resources
- Repository template
- Cheat sheet
Step-by-step instructions
- 1
Initialise the repository
Create the repo and add a .gitignore that excludes large result files and licences.
- 2
Commit in meaningful units
Each commit should represent one logical change with a message explaining why, not what.
- 3
Work in branches
Create a branch per study or feature so the main branch always holds reviewed work.
- 4
Review with pull requests
Use pull requests for a second pair of eyes, even in a team of two.
- 5
Tag releases
Tag the exact state used for a report so results can always be reproduced.
Expected result
A clean repository history where any reported result maps to a specific tagged commit.
Troubleshooting
| Problem | How to fix it |
|---|---|
| Repository is huge | Remove result files from history and store them outside Git. |
| Merge conflicts in notebooks | Clear outputs before committing or use a notebook diff tool. |
Final checklist
- .gitignore in place
- Branch per study
- Reviewed before merge
- Report state tagged