Git is a version control system that allows you to track changes to your documentation and collaborate with team members. With Git, for every file in your project, you can see what changed, when, and why. Git also makes it easy to revert to previous versions of files if you ever need to. The web editor performs some Git operations behind the scenes. Understanding these concepts will help you work more effectively with the web editor and collaborate with team members who are working in their local development environments.

Core Git concepts

How the web editor uses Git

The web editor connects to your Git repository through the GitHub App or GitLab integration and automates common Git operations. When you:
  • Open a file: The editor fetches the latest version from your repository, ensuring you’re always working with up to date content.
  • Make changes: The editor tracks your changes as a draft that can become a commit when you’re ready to save your work.
  • Save changes: The editor makes a commit with your changes, preserving your work in the project history.
  • Create a branch: The editor creates a new branch in your repository that can be used by anyone with access to the repository so they can collaborate and review changes.
  • Publish on your deployment branch: The editor commits and pushes directly to your deployment branch, which publishes your changes immediately.
  • Publish on other branches: The editor creates a pull request, which allows you to get feedback from others before merging your changes into your deployment branch.

Git best practices

Every team will develop their own workflows and preferences, but these are some general best practices to get you started.
  • Write descriptive commit messages: Be specific about what changed using active language.
  • Use descriptive branch names: Branch names should explain the work being done and be meaningful to someone who is looking at the branches in your repository.
  • Keep branches focused: Keep the changes on a branch focused on a specific task or project.
  • Delete branches after merging: Delete branches when you no longer need them to keep your repository tidy.