Git Integration Controls NEW
HarbourBuilder includes full Git integration — 10 components and comprehensive IDE support for version control. No external tools needed; manage your repositories directly from the IDE.
HarbourBuilder wraps the git CLI via CreateProcess with stdout capture,
providing a VS Code-style Source Control experience within the IDE.
Git Components
| Component | CT ID | Description |
|---|---|---|
TGitRepo | 121 | Repository initialization, cloning, and status |
TGitCommit | 122 | Commit changes with messages and file selection |
TGitBranch | 123 | Branch creation, switching, and listing |
TGitLog | 124 | View commit history with author, date, and message |
TGitDiff | 125 | View file differences and changes |
TGitRemote | 126 | Manage remote repositories (add, remove, list) |
TGitStash | 127 | Stash and unstash working directory changes |
TGitTag | 128 | Create, list, and delete tags |
TGitBlame | 129 | Line-by-line author information (annotate) |
TGitMerge | 130 | Merge branches and resolve conflicts |
IDE Git Integration
Source Control Panel
Access via Git > Status menu item. The panel shows:
- Branch label — Current branch name
- Changes ListView — Staged and unstaged changes
- Commit message editor — Multi-line text input
- Action buttons — Refresh, Commit, Push, Pull, Stash
The panel uses a dark-themed style matching VS Code's Source Control view.
Git Menu (17 Items)
| Menu Item | Action |
|---|---|
| Init | Initialize a new Git repository |
| Clone | Clone an existing remote repository |
| Status | Open Source Control panel |
| Commit | Commit staged changes |
| Push | Push commits to remote |
| Pull | Pull updates from remote |
| Branch > Create | Create a new branch |
| Branch > Switch | Switch to another branch (with list dialog) |
| Branch > Merge | Merge a branch into current |
| Stash > Save | Stash working directory changes |
| Stash > Pop | Restore stashed changes |
| Log | View commit history |
| Diff | View file differences |
| Blame | View line-by-line authorship |
Backend Functions
11 backend functions wrap git.exe CLI via CreateProcess with stdout capture:
| Function | Git Command | Return Format |
|---|---|---|
GIT_Status() | git status --porcelain | { { cStatus, cFile }, ... } |
GIT_Log() | git log --format=... | { { cHash, cAuthor, cDate, cMsg }, ... } |
GIT_Diff() | git diff | Unified diff string |
GIT_Blame() | git blame | { { nLine, cHash, cAuthor, cText }, ... } |
GIT_CurrentBranch() | git branch --show-current | Branch name string |
GIT_BranchList() | git branch | { { cName, lCurrent }, ... } |
GIT_Exec() | Any git command | Captured stdout string |
GIT_IsRepo() | git rev-parse | Logical (.T./.F.) |
GIT_RemoteList() | git remote -v | { { cName, cURL }, ... } |
GIT_StashList() | git stash list | { { cStash, cMsg }, ... } |
Code Examples
Initialize a Repository
local oRepo oRepo := TGitRepo:New() if ! GIT_IsRepo( "C:\MyProject" ) GIT_Exec( "git init C:\MyProject" ) MsgInfo( "Repository initialized" ) endif
View Status and Commit
local aStatus, cMsg aStatus := GIT_Status() for each aFile in aStatus ? aFile[1], aFile[2] // Status code and filename next GIT_Exec( "git add ." ) GIT_Exec( "git commit -m \"Initial commit\"" )
Branch Operations
local aBranches // List all branches aBranches := GIT_BranchList() for each aBranch in aBranches ? aBranch[1], if( aBranch[2], "* current", "" ) next // Create and switch to new branch GIT_Exec( "git checkout -b feature/new-feature" )
View Commit Log
local aLog aLog := GIT_Log( 20 ) // Last 20 commits for each aCommit in aLog ? aCommit[1] // Hash ? aCommit[2] // Author ? aCommit[3] // Date ? aCommit[4] // Message next
Blame a File
local aBlame aBlame := GIT_Blame( "source/main.prg" ) for each aLine in aBlame ? "Line", aLine[1], "by", aLine[3], ":", aLine[4] next
Branch Switching
When switching branches via Git > Branch > Switch, a list dialog shows all available branches. Select the target branch and click OK. The IDE will:
- Check for uncommitted changes
- Prompt to stash if changes exist
- Execute
git checkout <branch> - Reload the project if files changed
HarbourBuilder's Git integration requires git to be installed and in your system PATH.
Download from git-scm.com.
Common Git Workflows
Initial Setup
// 1. Initialize repository GIT_Exec( "git init" ) // 2. Add remote GIT_Exec( "git remote add origin https://github.com/user/repo.git" ) // 3. Add all files GIT_Exec( "git add ." ) // 4. Commit GIT_Exec( "git commit -m \"Initial commit\"" ) // 5. Push to remote GIT_Exec( "git push -u origin master" )
Daily Workflow
// 1. Pull latest changes GIT_Exec( "git pull" ) // 2. Make changes in IDE... // 3. Check status aStatus := GIT_Status() // 4. Stage and commit GIT_Exec( "git add ." ) GIT_Exec( "git commit -m \"Add feature X\"" ) // 5. Push to remote GIT_Exec( "git push" )