Use Git in your Workspace

If you want to use Git workflows such as creating branches, committing code, and pushing or pulling changes in a workspace, you must use Git-based projects or imported Git repositories.

To use Git, you can:

Use the IDE

If you prefer a user interface, or you do not have much experience using a terminal, you can use your Git service provider’s user interface (such as GitHub) with the actions in a Domino workspace’s navigation pane. Click on File Changes to perform actions such as Select and Sync (if configured in your environment), Sync to Domino, and Pull.

Use the terminal

Start a terminal in your workspace and use Git just like you would in a local environment. See the Git cheatsheet for common workflows.

Use the plugin

Many IDEs integrate with Git or have plugins or extensions for Git.

Domino’s Git-based projects fully support these features. You can use them to interact with Git in Domino. See the following resources for information about how to use Git with your IDE:

Commit and push changes to your Git repository

Note

In a Git-based project, the default working directory for your project’s code is /mnt/code.

Commit changes to your code and push them to your repository

  1. Go to the workspace where you made changes to a file.

  2. In the navigation pane, click File Changes.

  3. In the Code section, expand Uncommitted Changes to view changes.

    The up (↑) arrow in the Code section indicates the number of commits that your branch is ahead of the upstream branch, while the down (↓) arrow indicates the number of commits that your branch is behind the upstream branch.

  4. Enter a commit message.

  5. Click Sync to Git. If your administrator enabled the option for you to select the changed files to commit, click Select and Sync.

  6. If you clicked Select and Sync, select the files to sync.

  7. Enter a commit message and click Sync to Git.

    Domino syncs and pushes your changes to your Git repository.

Important

If you encounter merge conflicts when you pull or push code to your repository, see Resolve merge conflicts.

Commit all changes to your Git repository

You can use Domino to commit and push all changes to the project’s Git repository. This is often referred to as syncing your changes.

  1. Go to your workspace.

  2. In the navigation pane, click File Changes.

  3. In All Changes, enter a commit message.

  4. Click Sync All Changes. Domino commits changes to your code and syncs them to your Git repository. It also commits changes to artifacts and syncs them to the Domino File System (DFS).

Note

In a Git-based project, the default working directory for your project’s code is /mnt/code.

Pull the latest changes from your Git repository

When you collaborate with others in Git-based projects, you must pull the latest changes to your code occasionally.

  1. Go to your workspace.

  2. In the navigation pane, click File Changes.

  3. In the Code section, click Pull. Domino pulls the latest changes into your workspace.

Note

In a Git-based project, the default working directory for your project’s code is /mnt/code.

Important

If you encounter merge conflicts when you pull or push code to your repository, see Resolve merge conflicts.

Resolve merge conflicts

You might encounter merge conflicts when you collaborate with colleagues. To resolve merge conflicts, you can use the Git service provider or a terminal.

Resolve conflicts with the Git service provider

When merge conflicts arise, Domino creates a new branch with the conflicts in your repository and pushes them to your Git service provider (such as GitHub or Bitbucket).

  1. Go to your Git service provider.

  2. Use your Git service provider’s application to create a pull request between the newly created branch and your original branch.

  3. Merge the pull request.

  4. Return to Domino.

    Note
    Do not pull any changes.
  5. Start a workspace terminal.

  6. Use the following to reset the branch:

    git reset --hard origin/name-of-branch`

    where name-of-branch is the name of your original branch.

  7. Click Pull. Domino pulls the resolved merge conflicts. Your branch is now free of merge conflicts.

Resolve conflicts with a terminal

If you prefer, you can resolve merge conflicts in a workspace terminal. For information about the typical Git workflow to resolve merge conflicts, see Git merge conflicts.