Committing changes

Every Moment doc is a collection of Markdown files stored in a Git repository on your device’s local storage. This guide will demonstrate how to use the Moment desktop app’s built-in git integration to inspect changes to a Moment doc, commit them to repo history and inspect the document history.

Prerequisites

This document assumes:

You have some high-level familiarity with Git. If you do not, consider reading a Git tutorial, like the GitHub tutorial.

You have already created your first Moment doc. If you have not, follow this guide.

You have not published, shared, or synced the Moment doc you are editing. If you have, the UI will appear differently.

Viewing changes to a Moment doc

Begin with a Moment doc. Make some changes, such as adding text.

⚠️ Be sure this doc has not been published, shared, or synced. If you do not have a Moment doc yet, start by following the guide Create your first doc.

After making changes, you should see a Commit draft button in the bottom left corner of the Moment doc UI:

⚠️ If this button says Sync changes or something other than Commit draft, you probably have published, synced, or shared this Moment doc. Please start the guide over with a new document. See Create your first doc for details.

To view the changes you’ve made to your Moment doc, click the Commit draft button.

This is the document versioning modal. The commit modal is the primary way to view changes to a doc, and commit them to repo history. It provides a detailed summary of the changes made to the current Moment doc. By the numbers in the picture, they are:

(#1): The text input to type a commit message and the button to create a commit. When you want to commit changes to repo history, you will type a message describing the changes. As the button says, when you click it, the changes will be committed to the main branch.

(#2): A list of changed files. Every file is attended by a status:

A: the file is being added to the repository

M: the file is tracked by git and has been modified

D: the file has been deleted and is no longer being tracked by git

R: the file has been renamed

!: the file is ignored

T: the file has changed type

?: the file is untracked by git

(#3): The list of commits in history and branch visualization. This clicking the commits in this list will let you “quick switch” between the diffs.

(#4): The file diff provided by git. This contains a summary of the lines that have changed in the file (added, deleted, etc.).

Committing the changes to repo history

Once you’ve reviewed the changes to the doc, enter a commit message and click the Commit to main button. It should look something like the following.

Looking at the revision history

You can use the blade on the left to navigate the commit you just made, as well as any other commits made in history.


Next steps

Now that you’ve committed to the repository, you might try the following: