# godotengine/godot-git-plugin architecture

> Architecture diagram of the GitHub repository godotengine/godot-git-plugin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/godotengine/godot-git-plugin
- Repository: https://github.com/godotengine/godot-git-plugin

## Overview

Godot Git Plugin implements Godot’s editor VCS interface, using libgit2 to provide Git operations. The principal workflow is: Godot’s editor invokes the registered VCS extension, which initializes a repository and exposes working-tree changes for staging, diffing, and committing; users can also manage branches and remotes or fetch, pull, and push. The source excerpt shows representative operations and callback behavior, but not every endpoint, so links for unsampled interactions are omitted or marked unverified.

Main entry points: [`godot-git-plugin/src/git_plugin.h`](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.h) (Git VCS Interface), [`thirdparty/git2/libgit2`](https://github.com/godotengine/godot-git-plugin/tree/master/thirdparty/git2/libgit2) (libgit2 Backend), [`godot-git-plugin/src/git_plugin.cpp`](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp) (Fetch Pull Push), [`godot-git-plugin/src/gdlibrary.cpp`](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/gdlibrary.cpp) (Extension Registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_extension["Godot Extension"]
  node_registration["Extension Registration<br/>[gdlibrary.cpp]"]
  node_vcs["Git VCS Interface<br/>[git_plugin.h]"]
end

subgraph group_local["Local Repository"]
  node_repository["Repository Setup<br/>[git_plugin.cpp]"]
  node_working["Working Tree Status<br/>[git_plugin.cpp]"]
  node_staging["Stage And Discard<br/>[git_plugin.cpp]"]
  node_branches["Branch Management<br/>[git_plugin.cpp]"]
end

subgraph group_history["History And Diffs"]
  node_commits["Commit Creation<br/>[git_plugin.cpp]"]
  node_historyread["Commit History<br/>[git_plugin.cpp]"]
  node_diffs["Diff Inspection<br/>[git_plugin.cpp]"]
end

subgraph group_remote["Remote Operations"]
  node_remotes["Remote Management<br/>[git_plugin.cpp]"]
  node_sync["Fetch Pull Push<br/>[git_plugin.cpp]"]
  node_callbacks["Git Callbacks<br/>[git_callbacks.cpp]"]
end

subgraph group_internals["Git Internals"]
  node_wrappers["Resource Wrappers<br/>[git_wrappers.h]"]
  node_libgit2["libgit2 Backend"]
end

node_editor(("Godot Editor"))
node_gitremote(("Git Remote"))

node_editor -->|"loads extension"| node_registration
node_registration -->|"registers class"| node_vcs
node_editor -->|"invokes VCS"| node_vcs
node_vcs -->|"initializes"| node_repository
node_vcs -->|"queries status"| node_working
node_vcs -->|"requests changes"| node_staging
node_vcs -->|"requests commit"| node_commits
node_vcs -->|"requests history"| node_historyread
node_vcs -->|"requests diff"| node_diffs
node_vcs -->|"manages branches"| node_branches
node_vcs -->|"manages remotes"| node_remotes
node_vcs -->|"requests sync"| node_sync
node_repository -->|"uses backend"| node_libgit2
node_working -->|"reads status"| node_libgit2
node_commits -->|"writes commit"| node_libgit2
node_historyread -->|"walks history"| node_libgit2
node_diffs -->|"reads diff"| node_libgit2
node_branches -->|"updates refs"| node_libgit2
node_remotes -->|"configures remotes"| node_libgit2
node_sync -->|"performs transfer"| node_libgit2
node_sync -.->|"exchanges data"| node_gitremote
node_sync -.->|"uses callbacks"| node_callbacks
node_callbacks -->|"reports diff hunks"| node_vcs
node_vcs -->|"uses wrappers"| node_wrappers
node_working -->|"manages resources"| node_wrappers

click node_registration "https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/gdlibrary.cpp"
click node_vcs "https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.h"
click node_repository "https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp"
click node_working "https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp"
click node_staging "https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp"
click node_commits "https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp"
click node_historyread "https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp"
click node_diffs "https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp"
click node_branches "https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp"
click node_remotes "https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp"
click node_sync "https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp"
click node_callbacks "https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_callbacks.cpp"
click node_wrappers "https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_wrappers.h"
click node_libgit2 "https://github.com/godotengine/godot-git-plugin/tree/master/thirdparty/git2/libgit2"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_registration,node_vcs toneBlue
class node_repository,node_working,node_staging,node_branches toneAmber
class node_commits,node_historyread,node_diffs toneMint
class node_remotes,node_sync,node_callbacks toneRose
class node_wrappers,node_libgit2,node_editor,node_gitremote toneIndigo
```

## Components

### Godot Extension

- [Extension Registration](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/gdlibrary.cpp): `godot-git-plugin/src/gdlibrary.cpp`
- [Git VCS Interface](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.h): `godot-git-plugin/src/git_plugin.h`

### Local Repository

- [Repository Setup](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp): `godot-git-plugin/src/git_plugin.cpp`
- [Working Tree Status](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp): `godot-git-plugin/src/git_plugin.cpp`
- [Stage And Discard](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp): `godot-git-plugin/src/git_plugin.cpp`
- [Branch Management](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp): `godot-git-plugin/src/git_plugin.cpp`

### History And Diffs

- [Commit Creation](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp): `godot-git-plugin/src/git_plugin.cpp`
- [Commit History](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp): `godot-git-plugin/src/git_plugin.cpp`
- [Diff Inspection](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp): `godot-git-plugin/src/git_plugin.cpp`

### Remote Operations

- [Remote Management](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp): `godot-git-plugin/src/git_plugin.cpp`
- [Fetch Pull Push](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_plugin.cpp): `godot-git-plugin/src/git_plugin.cpp`
- [Git Callbacks](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_callbacks.cpp): `godot-git-plugin/src/git_callbacks.cpp`

### Git Internals

- [Resource Wrappers](https://github.com/godotengine/godot-git-plugin/blob/master/godot-git-plugin/src/git_wrappers.h): `godot-git-plugin/src/git_wrappers.h`
- [libgit2 Backend](https://github.com/godotengine/godot-git-plugin/tree/master/thirdparty/git2/libgit2): `thirdparty/git2/libgit2`

### Other components

- **Godot Editor**
- **Git Remote**

## Connections

- Godot Editor → Extension Registration: loads extension (evidence: `README.md`)
- Extension Registration → Git VCS Interface: registers class (evidence: `godot-git-plugin/src/gdlibrary.cpp`)
- Godot Editor → Git VCS Interface: invokes VCS (evidence: `README.md`)
- Git VCS Interface → Repository Setup: initializes (evidence: `godot-git-plugin/src/git_plugin.h`)
- Git VCS Interface → Working Tree Status: queries status (evidence: `godot-git-plugin/src/git_plugin.h`)
- Git VCS Interface → Stage And Discard: requests changes (evidence: `godot-git-plugin/src/git_plugin.h`)
- Git VCS Interface → Commit Creation: requests commit (evidence: `godot-git-plugin/src/git_plugin.h`)
- Git VCS Interface → Commit History: requests history (evidence: `godot-git-plugin/src/git_plugin.h`)
- Git VCS Interface → Diff Inspection: requests diff (evidence: `godot-git-plugin/src/git_plugin.h`)
- Git VCS Interface → Branch Management: manages branches (evidence: `godot-git-plugin/src/git_plugin.h`)
- Git VCS Interface → Remote Management: manages remotes (evidence: `godot-git-plugin/src/git_plugin.h`)
- Git VCS Interface → Fetch Pull Push: requests sync (evidence: `godot-git-plugin/src/git_plugin.h`)
- Repository Setup → libgit2 Backend: uses backend (evidence: `README.md`)
- Working Tree Status → libgit2 Backend: reads status (evidence: `godot-git-plugin/src/git_plugin.cpp`)
- Commit Creation → libgit2 Backend: writes commit (evidence: `godot-git-plugin/src/git_plugin.cpp`)
- Commit History → libgit2 Backend: walks history (evidence: `godot-git-plugin/src/git_plugin.cpp`)
- Diff Inspection → libgit2 Backend: reads diff (evidence: `godot-git-plugin/src/git_plugin.cpp`)
- Branch Management → libgit2 Backend: updates refs (evidence: `godot-git-plugin/src/git_plugin.cpp`)
- Remote Management → libgit2 Backend: configures remotes (evidence: `godot-git-plugin/src/git_plugin.cpp`)
- Fetch Pull Push → libgit2 Backend: performs transfer (evidence: `README.md`)
- Fetch Pull Push → Git Remote: exchanges data
- Fetch Pull Push → Git Callbacks: uses callbacks
- Git Callbacks → Git VCS Interface: reports diff hunks (evidence: `godot-git-plugin/src/git_callbacks.cpp`)
- Git VCS Interface → Resource Wrappers: uses wrappers (evidence: `godot-git-plugin/src/git_plugin.h`)
- Working Tree Status → Resource Wrappers: manages resources (evidence: `godot-git-plugin/src/git_plugin.cpp`)
