Skip to main content

Git export

Create an audit trail by exporting your Hex projects and components to a Git repository.

info
  • Available on the Team and Enterprise plans
  • Users will need the Admin role to set up Git export repositories.
  • Users will need Can Edit permissions or higher to enable Git export for a project.

Hex projects and components can be exported to a Git repository. Hex projects are represented in Git repos as YAML files that describe the logic and configurations of each cell, as well as information about your app layout. You can read more about the file format here.

This feature lets teams keep a copy of their code outside of Hex, allowing users to track changes over time and audit code as needed.

When using this feature, it is recommended to set up a connection to a dedicated repository used only for exporting Hex projects. Since Hex merges commits on behalf of the user who is publishing a project, this feature is not compatible with repositories that use branch protection. The repository must allow users to merge commits without requiring a review.

Hex projects can be exported to a Git repo on a per-project basis. Once Git export is enabled for a project, publishing a version will create a merge commit on the specified publish branch.

Supported Git Providers

The following providers are supported:

Git ProviderNotes
GitHubRepositories must be hosted on github.com. Support for custom URLs coming soon.
GitLabRepositories must be hosted on gitlab.com.

Support for Bitbucket and Azure DevOps is currently in development.

Set up a Git export repo

Only Hex Admins are able to set up Git export repositories. The repository access must also be approved by a repository admin on the Git side.

To set up a Git repo to export projects to:

  • Head to the SettingsIntegrations tab, under the "Workspace" header.
  • Click "Connect" for either GitHub or GitLab, and go through the OAuth flow
  • Add a repository using the "+ Repository" button
  • Choose a publish branch: this is the branch that will reflect the published version of your app
  • Choose which groups are able to write to the repository

Note that only one GitHub or GitLab account can be connected to a given Hex workspace. Similarly, a given GitHub or GitLab account can only be connected to one Hex workspace.

Export a Hex project to a Git repo

To export a project to a GitHub or GitLab repo:

  1. From the History & versions tab of the left side panel, turn on Git export. If multiple repos are enabled for your workspace, you will be able to choose which repo to export to.
  2. Choose a file path that you would like Hex to use as the name of the exported file — by default, Hex will choose a file path that matches your project name.

Each time you save a version of your work, a commit will be written to a working branch (a separate branch per project). The commit will use the current Hex user’s email as the author.

When you next publish your project, Hex will merge the commits to your publish branch.

FAQs

Can I require Git export for all my projects?

Not currently; Git export must be enabled on a per-project basis.

What happens if I turn off Git export?

If Git export is turned off for a project, the file in Git will not be deleted. The commit history will remain in the repository.

What happens if I am not an admin on the repository I want to connect to Hex?

If you are not an admin on the repository you want to connect to Hex, you will not be able to add the repository until an admin of the repo approves the connection. If you are connecting to GitHub and do not have the appropriate access to a repository, the repo will have a "request" tag next to it when configuring access. This will send a request to the repository's admins to approve the connection.

How do I change the name of the file that I’m writing to?

If you would like to change the name of the file you are writing to, make sure to do so from Hex.

  1. In the Git Export settings for your project, click the 3-dot menu next to the repo and branch name
  2. Update the file path you want to write to from Hex
  3. Publish a new version

Publishing will merge the commit to the new file path. The existing commit history will remain in the old path.

What happens if my repository uses branch protection?

Git export is not compatible with repositories that use branch protection or require reviews before merging commits. Turn these settings off on your repository in order to use this feature successfully.

How can I pull in external changes made in my Git repo?

At this time, Git export is one-way only.