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
- Install
git
- Join GitHub
- If new to GitHub, follow the GitHub Quickstart to become familiar with GitHub
- Further reading, to better understand these tools: Learn Git and GitHub
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
- 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.
- 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.
- Click on
Initialize Repository
to set up a git repo in the Dendron vault. - Then, once you've added and committed the files, use the command palette to
Publish to GitHub
. - 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:
- https://stackoverflow.com/questions/46877667/how-to-add-a-new-project-to-github-using-vs-code/63898638#63898638
- https://code.visualstudio.com/docs/editor/versioncontrol
Backlinks