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.

Built-In Source Control

HarbourBuilder wraps the git CLI via CreateProcess with stdout capture, providing a VS Code-style Source Control experience within the IDE.

Git Components

ComponentCT IDDescription
TGitRepo121Repository initialization, cloning, and status
TGitCommit122Commit changes with messages and file selection
TGitBranch123Branch creation, switching, and listing
TGitLog124View commit history with author, date, and message
TGitDiff125View file differences and changes
TGitRemote126Manage remote repositories (add, remove, list)
TGitStash127Stash and unstash working directory changes
TGitTag128Create, list, and delete tags
TGitBlame129Line-by-line author information (annotate)
TGitMerge130Merge branches and resolve conflicts

IDE Git Integration

Source Control Panel

Access via Git > Status menu item. The panel shows:

The panel uses a dark-themed style matching VS Code's Source Control view.

Git Menu (17 Items)

Menu ItemAction
InitInitialize a new Git repository
CloneClone an existing remote repository
StatusOpen Source Control panel
CommitCommit staged changes
PushPush commits to remote
PullPull updates from remote
Branch > CreateCreate a new branch
Branch > SwitchSwitch to another branch (with list dialog)
Branch > MergeMerge a branch into current
Stash > SaveStash working directory changes
Stash > PopRestore stashed changes
LogView commit history
DiffView file differences
BlameView line-by-line authorship

Backend Functions

11 backend functions wrap git.exe CLI via CreateProcess with stdout capture:

FunctionGit CommandReturn Format
GIT_Status()git status --porcelain{ { cStatus, cFile }, ... }
GIT_Log()git log --format=...{ { cHash, cAuthor, cDate, cMsg }, ... }
GIT_Diff()git diffUnified diff string
GIT_Blame()git blame{ { nLine, cHash, cAuthor, cText }, ... }
GIT_CurrentBranch()git branch --show-currentBranch name string
GIT_BranchList()git branch{ { cName, lCurrent }, ... }
GIT_Exec()Any git commandCaptured stdout string
GIT_IsRepo()git rev-parseLogical (.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:

  1. Check for uncommitted changes
  2. Prompt to stash if changes exist
  3. Execute git checkout <branch>
  4. Reload the project if files changed
Git CLI Dependency

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" )

On This Page

Getting Started Component Palette IDE Features Tutorials Reference Platforms Git Components IDE Git Integration Source Control Panel Git Menu (17 Items) Backend Functions Code Examples Initialize a Repository View Status and Commit Branch Operations View Commit Log Blame a File Branch Switching Common Git Workflows Initial Setup Daily Workflow