DEV Community

Anshul Jangale
Anshul Jangale

Posted on

Git Integration in Microsoft Fabric

This guide walks you through the basic tasks for using Microsoft Fabric’s Git integration tool, including how to connect a workspace to a Git repository, commit changes, update from Git, and disconnect from Git.


Prerequisites

Fabric Prerequisites

  • Access to a Fabric capacity is required to use all supported Fabric items. You can sign up for a free trial if you don't have one.
  • The following tenant switches must be enabled from the Admin portal:
    • Users can create Fabric items
    • Users can synchronize workspace items with their Git repositories
    • Create workspaces (needed if branching out to a new workspace)
    • Users can synchronize workspace items with GitHub repositories (for GitHub users)
  • These switches can be enabled by tenant admin, capacity admin, or workspace admin depending on organizational settings.

Git Prerequisites

  • Git integration supports Azure DevOps or GitHub repositories.
  • You must have:
    • An active Azure account registered to the same user as the Fabric workspace.
    • Access to an existing Git repository in Azure DevOps or GitHub.

Connect a Workspace to a Git Repo

Connect to a Git Repo

Only workspace admins can connect a workspace to a Git repository, though anyone with permission can work in the connected workspace.

To connect:

  1. Sign in to Microsoft Fabric and navigate to the workspace.
  2. Go to Workspace settings.
  3. Choose your Git provider—Azure DevOps or GitHub.
  4. For Azure DevOps, click Connect to automatically sign in using the Azure Repos account associated with your Microsoft Entra user.

Connect to a Workspace Branch

  1. From the dropdown menu, specify:
    • Organization
    • Project
    • Git repository
    • Branch (select an existing branch or create a new one)
    • Folder (existing or new folder; blank creates content in root)


Click Connect and sync.

  • On initial sync, if one side (workspace or Git branch) is empty, content copies from the nonempty side.

If both sides have content, you choose the sync direction.

Commit Changes to Git

After connecting, you can edit the workspace normally. Changes are saved only in the workspace until committed to the Git branch.

To commit changes:

Go to the workspace and click the Source control icon which shows the number of uncommitted changes.

  1. Choose items to commit or select all.

  2. Add a comment (default added if empty).

  3. Click Commit.

After commit, items are removed from the changes list, and the status changes from Uncommitted to Synced.

When others commit changes to the connected Git branch, a notification shows in the workspace.

To update:

  1. Go to the workspace.
  2. Click the Source control icon.
  3. Select Updates to see changes since the last sync.
  4. Click Update all.

After a successful update, changes are applied, and status changes to Synced.

Only workspace admins can disconnect a workspace.

Steps to disconnect:

  1. Go to Workspace settings.
  2. Select Git integration.
  3. Click Disconnect workspace.
  4. Confirm by selecting Disconnect again.

Manage Branches in Microsoft Fabric Workspaces

  1. Collaboration Workspace (Main Branch)
    • The collaboration workspace is connected to the main branch of the repo.
    • This workspace contains the consolidated, reviewed, and approved versions of the work shared by the team.
  2. Feature Branch Workspaces (Developer Workspaces)
    • Each developer can create their own feature branch in the workspace setting of Git Integration created off of main (e.g., "feature1", "feature2").

  • Each developer works in their own workspace connected to their respective feature branch.
  • Developers make changes, commit them locally, and push to their feature branches.
  • Pull Requests and Merging
    • Changes from feature branches are merged into the main branch via pull requests (PRs) in Azure DevOps.
    • PRs require review and approval ensuring code quality and collaboration governance.
  • Syncing and Updating Workspaces
    • Once a PR is merged into main, the collaboration workspace can be updated to reflect the merged changes.

  • Developers keep their feature branches long-lived, which means they occasionally need to sync their branches with main to get the latest changes. As Fabric does not support direct branch updates inside the workspace, this update is done by creating a PR from main back into the feature branch in Azure DevOps.
  • Branch Policies and Permissions
    • Branch policies, like requiring minimum reviewers, help protect the main branch from direct commits, ensuring all changes come through PRs.

Top comments (0)