From fcb190281caeb6dceef33ed4df6344ade22e6583 Mon Sep 17 00:00:00 2001 From: Engel Nyst Date: Fri, 25 Jul 2025 15:45:00 +0200 Subject: [PATCH] microagent: Add Git best practices (#9335) Co-authored-by: OpenHands --- .openhands/microagents/repo.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.openhands/microagents/repo.md b/.openhands/microagents/repo.md index 5900382f4c..9196b9cc9b 100644 --- a/.openhands/microagents/repo.md +++ b/.openhands/microagents/repo.md @@ -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. - - 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). @@ -32,6 +30,12 @@ then re-run the command to ensure it passes. Common issues include: - Trailing whitespace - Missing newlines at end of files +## Git Best Practices + +- Prefer specific `git add ` 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/` on the same branch + ## Repository Structure Backend: - Located in the `openhands` directory