A goal-driven AI agent for complete Git repository operations, built from scratch.
Git Agent is an open-source project from Dev Collaboration Hub that aims to build an AI agent capable of understanding a repository, translating a user goal into a safe execution plan, modifying files, operating Git, and publishing the resulting work to a remote repository.
The project is being developed from scratch, milestone by milestone. The goal is not to create a collection of Git command shortcuts, but a repository-aware engineering agent that can decide what Git actions are required to achieve a requested outcome.
Project status: Early development. The capabilities below describe the target system and will be unlocked progressively through the roadmap.
Given a high-level request such as:
Add a configuration file, update the documentation, commit the changes,
and upload them to the repository.
Git Agent should eventually be able to perform the complete workflow:
User Goal
↓
Repository Inspection
↓
Goal Interpretation
↓
Execution Plan
↓
File Operations
↓
Diff / Safety Validation
↓
Git Operations
↓
Commit
↓
Remote Synchronization / Push
↓
Final Verification
- Detect and inspect Git repositories
- Understand repository state and structure
- Read branches, remotes, HEAD, history, tags, and working-tree changes
- Detect staged, unstaged, untracked, ignored, and conflicting files
- Understand the difference between local and remote repository state
- Create files and directories
- Read and edit existing files
- Rename and move files
- Delete files safely
- Respect
.gitignore - Inspect changes before Git operations
- Upload newly created or modified files through the repository workflow
The target is broad Git coverage, including:
initclonestatusaddcommitlogdiffshowrestoreresetrevertrmmvbranchswitchcheckoutmergerebasecherry-pickstashtagremotefetchpullpush- conflict detection and resolution workflows
- repository recovery workflows
Git Agent should not require the user to specify every Git command.
Instead of:
git add README.md
git commit -m "Update README"
git push origin mainA user should be able to say:
Update the README with the new installation instructions and publish the change.
The agent should determine the required steps, execute them in the correct order, validate the result, and report what changed.
- Create and switch branches
- Determine an appropriate branch workflow
- Compare branches
- Merge branches
- Rebase branches
- Cherry-pick commits
- Create and manage tags
- Inspect commit ancestry
- Handle detached HEAD states
- Detect and resolve merge/rebase conflicts
- Recover from failed history operations
- Inspect and configure remotes
- Fetch remote state
- Pull changes safely
- Push commits and branches
- Push tags
- Detect ahead/behind/diverged branches
- Prevent accidental destructive remote operations
- Verify that published changes actually exist on the remote
- Determine which files belong to the requested task
- Avoid committing unrelated changes
- Review diffs before committing
- Generate meaningful commit messages
- Create logically scoped commits
- Verify commits after creation
Git operations can destroy work when used incorrectly, so safety is a first-class part of the project.
The agent should:
- Inspect repository state before mutations
- Detect dirty working trees
- Avoid silently overwriting user work
- Identify destructive operations before execution
- Keep task changes separate from unrelated changes
- Validate diffs before commit/push
- Recover from interrupted merge/rebase/cherry-pick operations
- Use Git history and reflog-based recovery when appropriate
- Verify repository integrity after critical operations
Git Agent separates decision-making from Git execution.
┌───────────────────────────────┐
│ User Goal │
└───────────────┬───────────────┘
↓
┌───────────────────────────────┐
│ Goal / Planning Layer │
│ What needs to be achieved? │
└───────────────┬───────────────┘
↓
┌───────────────────────────────┐
│ Repository Analysis │
│ What is the current Git state?│
└───────────────┬───────────────┘
↓
┌───────────────────────────────┐
│ Safety Validator │
│ Is the planned action safe? │
└───────────────┬───────────────┘
↓
┌───────────────────────────────┐
│ Git Execution Layer │
│ Perform deterministic actions │
└───────────────┬───────────────┘
↓
┌───────────────────────────────┐
│ Result Verification │
│ Was the original goal met? │
└───────────────────────────────┘
The AI layer decides what should happen. The Git layer is responsible for executing well-defined operations and returning structured results.
git-agent/
├── agent/
│ ├── goal_engine.py
│ ├── planner.py
│ ├── executor.py
│ └── verifier.py
├── git/
│ ├── repository.py
│ ├── status.py
│ ├── staging.py
│ ├── commits.py
│ ├── branches.py
│ ├── history.py
│ ├── merge.py
│ ├── rebase.py
│ ├── stash.py
│ ├── tags.py
│ ├── remotes.py
│ └── recovery.py
├── workspace/
│ ├── files.py
│ └── diff.py
├── safety/
│ ├── policy.py
│ └── validator.py
├── tests/
├── docs/
└── README.md
This structure is a target architecture and may evolve as implementation evidence grows.
| Milestone | Focus | Capability Unlocked |
|---|---|---|
| M0 | Repository foundation | Inspect and model a Git repository safely |
| M1 | Workspace/file operations | Create, edit, move, delete, and inspect files |
| M2 | Status, diff, staging, commits | Produce validated local commits |
| M3 | Branches and history | Work across branches and inspect history |
| M4 | Merge, rebase, cherry-pick, stash | Perform advanced local Git workflows |
| M5 | Remotes, fetch, pull, push, tags | Publish and synchronize repository work |
| M6 | Conflict handling and recovery | Recover safely from difficult Git states |
| M7 | Goal engine and planner | Convert natural-language goals into Git tasks |
| M8 | Autonomous execution | Execute repository tasks from goal to verified result |
| M9 | Full Git Agent evaluation | Demonstrate broad, reliable Git engineering capability |
python -m git_agent "Create a docs folder, add architecture documentation, commit it, and push it."Expected behavior:
1. Inspect repository
2. Inspect current branch and working tree
3. Convert the goal into concrete operations
4. Create/update required files
5. Review the diff
6. Stage only task-related changes
7. Create a meaningful commit
8. Synchronize with the remote safely
9. Push the commit
10. Verify the remote result
11. Report the completed work
Git Agent is not intended to be:
- a thin alias around Git commands
- a blind shell-command generator
- an agent that commits every changed file without inspection
- an agent that force-pushes or rewrites history without safeguards
- a replacement for Git itself
It is intended to become an intelligent operator built on top of Git.
- Build from scratch, capability by capability
- Keep Git execution deterministic and inspectable
- Prefer explicit repository state over assumptions
- Validate before destructive operations
- Never silently include unrelated changes
- Treat recovery as a core capability, not an afterthought
- Verify every milestone with tests
- Measure capability by demonstrated behavior, not documentation claims
The repository has just started. Implementation will proceed from the Git foundation upward rather than pretending the complete agent already exists.
The first engineering milestone is M0 — Repository Foundation.
Contributions are welcome as the project grows. Keep changes focused, testable, and aligned with the milestone currently under development.
Built under Dev Collaboration Hub as an open-source engineering project.