microagent: Add Git best practices (#9335)

Co-authored-by: OpenHands <openhands@all-hands.dev>
This commit is contained in:
Engel Nyst 2025-07-25 15:45:00 +02:00 committed by GitHub
parent 9fcf900a23
commit fcb190281c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,8 +15,6 @@ make build && make run FRONTEND_PORT=12000 FRONTEND_HOST=0.0.0.0 BACKEND_HOST=0.
IMPORTANT: Before making any changes to the codebase, ALWAYS run `make install-pre-commit-hooks` to ensure pre-commit hooks are properly installed. IMPORTANT: Before making any changes to the codebase, ALWAYS run `make install-pre-commit-hooks` to ensure pre-commit hooks are properly installed.
Before pushing any changes, you MUST ensure that any lint errors or simple test errors have been fixed. Before pushing any changes, you MUST ensure that any lint errors or simple test errors have been fixed.
* If you've made changes to the backend, you should run `pre-commit run --config ./dev_config/python/.pre-commit-config.yaml` (this will run on staged files). * If you've made changes to the backend, you should run `pre-commit run --config ./dev_config/python/.pre-commit-config.yaml` (this will run on staged files).
@ -32,6 +30,12 @@ then re-run the command to ensure it passes. Common issues include:
- Trailing whitespace - Trailing whitespace
- Missing newlines at end of files - Missing newlines at end of files
## Git Best Practices
- Prefer specific `git add <filename>` instead of `git add .` to avoid accidentally staging unintended files
- Be especially careful with `git reset --hard` after staging files, as it will remove accidentally staged files
- When remote has new changes, use `git fetch upstream && git rebase upstream/<branch>` on the same branch
## Repository Structure ## Repository Structure
Backend: Backend:
- Located in the `openhands` directory - Located in the `openhands` directory