Fetching and Syncing Remotes Using the Dolt Workbench

WORKBENCHFEATURE RELEASE
2 min read

We're excited to roll out fetching and syncing with remote databases from the Dolt Workbench. For more detailed information about fetching, check out our documentation. Follow this step-by-step guide to see how you can use the Dolt Workbench to simplify how you manage remotes for your Dolt and Doltgres databases.

When you're using Dolt remotes, like DoltHub for example, fetching allows you to check if there are any updates or commits on the remote that could be integrated into your local branches. If a teammate has pushed changes to the remote you can fetch the remote to inspect the changes without affecting your current local development work. If you find changes on the remote that you want to apply to your local branch, always pull them first to avoid potential upstream merge conflicts. Similarly, when you're ready to share your local commits with the team, you can push the changes to the remote so that your coworkers can seamlessly merge them into their branches. Fetch and sync help you ensure that all team members are working with the most updated and conflict-free data.

Setting Up

To get started, let’s create a local Dolt SQL server. If you haven’t installed Dolt yet, follow this installation guide.

mkdir doltdb && cd doltdb
dolt init

Create a develop branch, which will be our collaborative branch.

dolt checkout -b develop

Start the server on this branch using the dolt sql-server command, which will default to using port 3306:

dolt sql-server

Launch the Dolt Workbench app and connect to your running Dolt SQL server. Enter the required connection details (e.g., hostname, port, username, and password), then click Launch Workbench.

connect to dolt sql server

Adding a remote

Create a database on DoltHub to use as our remote.

create doltdb on DoltHub

To set up pushing to DoltHub, create credentials by running dolt login in the doltdb folder. Refer to this guide for detailed instructions on authentication.

In the Dolt Workbench app, add the remote by specifying the remote name and URL:

add remote

The newly added remote will now appear in the Remotes tab:

added remote

Pushing the develop branch to the remote

From the Actions dropdown in remote tab, select push to remote and enter develop to push this new branch to the remote on DoltHub.

push develop branch to remote

We will see the develop branch now listed on DoltHub.

develop branch on dolthub

Making Changes from the Dolt Workbench

Next, add data to the books table using workbench.

insert into books (title, author) values ('The Afronauts', 'Cristina De Middel');

insert a row into books

Then commit the changes:

commit change

Synchronization

You can use the Fetch feature from the Actions dropdown in the Remotes tab to check if your branch is ahead or behind the remote. The local develop branch will be one commit ahead after our recent changes.

ahead by 1 commit

Sync your local develop branch with the remote origin/develop by pushing the changes. This will update DoltHub with our latest modifications.

develop branch up to date

changes on dolthub

If a coworker has updated the develop branch on DoltHub, fetch again to see the status.

behind by 1 commit

If behind, pull the changes to update your local branch.

changes updated in workbench

Conclusion

Fetch and sync in the Dolt Workbench ensure seamless collaboration and keep your project’s branches synchronized across your team. Explore these features to streamline your development workflow!

Have feature requests or questions? Join us on Discord, or file an issue on GitHub.

SHARE

JOIN THE DATA EVOLUTION

Get started with Dolt

Or join our mailing list to get product updates.