Skip to main content

Getting Started with PreTeXt

Section Part 7. Save Your Work to GitHub

Your edits live inside the Codespace, which is a good enough home for an active work session but not a permanent one. GitHub will eventually recycle inactive Codespaces (after about a month of disuse at the time of writing), so you should periodically push your work back to the repository on github.com, where it is safe forever.
The operation has two parts, traditionally called commit (take a snapshot of the current state with a short note) and sync (upload the snapshot to GitHub). The Codespace combines them into a single action.
  1. On the left side of the window, find the Source Control icon: it looks like a branching diagram with three dots. Click it.
  2. Youโ€™ll see a list of files youโ€™ve changed. At the top thereโ€™s a text box asking for a message. Type something brief that describes what you did, for example Add right triangles lesson.
  3. Click the blue Commit & Sync button (sometimes labeled Commit the first time, with Sync appearing after). If asked to confirm, say yes. You may also be asked to allow the Codespace to act on your behalf, which is expected.
  4. After a few seconds, the changed-files list empties. Your work is now saved to github.com/YOUR-USERNAME/YOUR-REPO-NAME.
The Source Control panel in VS Code, showing the branching-diagram icon on the left rail, a list of changed files, a commit message text box, and a blue Commit and Sync button.

โœ“ You know it worked whenโ€ฆ.

Open a new tab, go to your repositoryโ€™s page on github.com, and youโ€™ll see your changed files listed with your commit message next to them. If you refresh the page you see your latest edits reflected in the source files on GitHub itself.

A habit worth building.

Commit and sync often. Every time you finish a meaningful chunk of work (a new example, a fixed exercise, a reorganized section) is a reasonable moment. Each commit is a save point you can return to later if you decide you liked an earlier version better.