Git

Summary

Git is the preferred version control system because it integrates with VS Code and GitHub.

The most likely case is you have a local repository that you need to now add to Git. Follow these steps to add your local vault to Git and push up to GitHub.

Prerequisites

git defaults

By default, git will initialize repositories with a master branch. Modifications to this behavior can be done at the CLI:

# Change default branch names in initialized git repos
git config --global init.defaultBranch main

If wanting to make a change in a current repository:

# Change current main branch name
git branch -m main

Using git with Dendron

  1. VS Code ships with an extension that manages Git source control support.

    Note: VS Code uses your computer's Git installation, so you need to install Git first before you get these features. Make sure you install at least version 2.0.0.

  2. Open your local Dendron workspace.

    Note: If you are new to Git, the git-scm website is a good place to start, with a popular online book, Getting Started videos and cheat sheets. This documentation assumes you are already familiar with Git.

  3. Click on Initialize Repository to set up a git repo in the Dendron vault.
  4. Then, once you've added and committed the files, use the command palette to Publish to GitHub.
  5. Follow the prompts and once you've entered in your GitHub credentials, you should be done.

    If you don't want to publish your notes just yet, make sure to mark the Git repository private.

Lookup

This section borrows heavily from the following:


Backlinks