|
1 | 1 | --- |
2 | 2 | title: "Git concepts" |
3 | | -description: "Learn how the web editor integrates with Git version control" |
| 3 | +description: "Learn Git fundamentals for the docs-as-code workflow" |
4 | 4 | --- |
5 | 5 |
|
6 | | -The web editor handles Git operations automatically, but understanding these concepts will help you work more effectively and collaborate better with team members using local development environments. |
| 6 | +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. |
| 7 | + |
| 8 | +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. |
7 | 9 |
|
8 | 10 | ## Core Git concepts |
9 | 11 |
|
10 | 12 | <AccordionGroup> |
11 | 13 | <Accordion title="Repository"> |
12 | | - Your documentation's source where all files and their history are stored. The web editor connects to your repository to access and modify content. Think of it as the master database for all your documentation files. |
| 14 | + Your documentation's source where all files and their history are stored. The web editor connects to your repository to access and modify content. |
13 | 15 | </Accordion> |
14 | 16 |
|
15 | 17 | <Accordion title="Commit"> |
16 | 18 | A saved snapshot of your changes at a specific point in time. Each commit includes a message describing what changed and creates a permanent record in your project history. |
17 | 19 | </Accordion> |
18 | 20 |
|
19 | 21 | <Accordion title="Branch"> |
20 | | - A separate workspace for making changes without affecting your live documentation. Think of it as a safe sandbox for experiments and larger updates where you can work on features independently. |
| 22 | + A branch points to a specific commit in your repository. Your live documentation is built from a deployment branch. You can have any number of other branches with changes that are not yet published to your live documentation. If you want to incorporate the changes from a branch into your live documentation, you can merge the branch into your deployment branch through a pull request. |
| 23 | + |
| 24 | + Use branches to work on changes without affecting your live documentation, safely experiment with new features, and get reviews before publishing. |
21 | 25 | </Accordion> |
22 | 26 |
|
23 | 27 | <Accordion title="Deployment branch"> |
24 | | - The main branch that contains your live documentation content. Changes to this branch are automatically published to your documentation site. Often called `main` or `master`. |
| 28 | + The primary branch of your project that your live documentation content is built from. Changes to this branch are automatically published to your documentation site. Often called `main`, but you can set any branch as your deployment branch. |
25 | 29 | </Accordion> |
26 | 30 |
|
27 | 31 | <Accordion title="Pull request"> |
28 | | - A way to propose merging your branch changes into your live documentation. Allows for review and discussion before changes go live. Also called a merge request in GitLab. |
| 32 | + A way to propose merging your changes on a branch into your live documentation. Allows for review and discussion before changes go live. Commonly called a PR, and also called a merge request in GitLab. |
29 | 33 | </Accordion> |
30 | 34 |
|
31 | 35 | <Accordion title="Diff"> |
32 | | - Shows the specific changes between two versions of a file. When reviewing pull requests, diffs highlight what has been added, removed, or modified, making it easy to see exactly what changed. |
| 36 | + A diff (or difference) shows the changes between two versions of a file. When reviewing pull requests, diffs highlight what has been added, removed, or modified, making it easy to identify what changed. |
33 | 37 | </Accordion> |
34 | 38 | </AccordionGroup> |
35 | 39 |
|
36 | 40 | ## How the web editor uses Git |
37 | 41 |
|
38 | | -The web editor connects to your Git repository through the [GitHub App](/settings/github) or [GitLab integration](/settings/gitlab) and automates common Git operations: |
39 | | - |
40 | | -### Automatic operations |
41 | | - |
42 | | -**When you open a file**: The editor fetches the latest version from your repository, ensuring you're always working with current content. |
43 | | - |
44 | | -**When you make changes**: The editor tracks your modifications as a draft that can become a commit when you're ready to save. |
45 | | - |
46 | | -**When you save changes**: Creates a commit with your changes and a descriptive message, preserving your work in the project history. |
47 | | - |
48 | | -**When you create a branch**: Sets up a new branch in your repository for isolated development work. |
49 | | - |
50 | | -**When you publish**: Either commits directly to your deployment branch (immediate publishing) or creates a pull request (review workflow). |
51 | | - |
52 | | -### Behind the scenes |
53 | | - |
54 | | -The web editor abstracts away complex Git commands while maintaining all the benefits of version control: |
55 | | - |
56 | | -- **Version history**: Every change is tracked with timestamps and descriptions |
57 | | -- **Collaboration**: Multiple people can work simultaneously without conflicts |
58 | | -- **Rollback capability**: Previous versions are always recoverable |
59 | | -- **Branch isolation**: Experimental changes don't affect live content |
60 | | - |
61 | | -## Why Git matters for documentation |
62 | | - |
63 | | -### Version control benefits |
64 | | -- **Track changes**: See exactly what changed, when, and why |
65 | | -- **Collaborate safely**: Multiple team members can contribute without overwriting each other's work |
66 | | -- **Rollback protection**: Easily revert to previous versions if something goes wrong |
67 | | -- **Audit trail**: Complete history of who made what changes |
68 | | - |
69 | | -### Collaborative workflows |
70 | | -- **Review process**: Pull requests enable team members to review changes before they go live |
71 | | -- **Parallel development**: Different team members can work on different features simultaneously |
72 | | -- **Integration**: Works seamlessly with developer workflows and CI/CD pipelines |
73 | | - |
74 | | -## Git vs. traditional documentation tools |
75 | | - |
76 | | -Unlike traditional documentation platforms, Git-based workflows provide: |
77 | | - |
78 | | -- **Developer integration**: Your docs live alongside your code in familiar developer tools |
79 | | -- **Branching**: Safe experimentation without affecting live content |
80 | | -- **Merge conflicts**: Intelligent handling when multiple people edit the same content |
81 | | -- **External collaboration**: Contributors can propose changes even without direct access |
| 42 | +The web editor connects to your Git repository through the [GitHub App](/settings/github) or [GitLab integration](/settings/gitlab) and automates common Git operations. |
82 | 43 |
|
83 | | -## Best practices |
| 44 | +When you: |
84 | 45 |
|
85 | | -### Commit messages |
86 | | -The web editor generates descriptive commit messages automatically, but understanding good commit practices helps when reviewing history: |
| 46 | +- **Open a file**: The editor fetches the latest version from your repository, ensuring you're always working with up to date content. |
| 47 | +- **Make changes**: The editor tracks your changes as a draft that can become a commit when you're ready to save your work. |
| 48 | +- **Save changes**: The editor makes a commit with your changes, preserving your work in the project history. |
| 49 | +- **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. |
| 50 | +- **Publish on your deployment branch**: The editor commits and pushes directly to your deployment branch, which publishes your changes immediately. |
| 51 | +- **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. |
87 | 52 |
|
88 | | -- Be specific about what changed |
89 | | -- Explain why the change was made |
90 | | -- Keep messages concise but informative |
| 53 | +## Git best practices |
91 | 54 |
|
92 | | -### Branching strategy |
93 | | -- Use feature branches for new content or major updates |
94 | | -- Keep branches focused on specific tasks or features |
95 | | -- Merge regularly to avoid large, complex merges |
96 | | -- Delete branches after merging to keep the repository clean |
| 55 | +Every team will develop their own workflows and preferences, but these are some general best practices to get you started. |
97 | 56 |
|
98 | | -### Collaboration |
99 | | -- Communicate with team members about active branches |
100 | | -- Review pull requests thoroughly before merging |
101 | | -- Pull latest changes before starting new work |
102 | | -- Use descriptive branch names that explain the work being done |
| 57 | +- **Write descriptive commit messages**: Be specific about what changed using active language. |
| 58 | +- **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. |
| 59 | +- **Keep branches focused**: Keep the changes on a branch focused on a specific task or project. |
| 60 | +- **Delete branches after merging**: Delete branches when you no longer need them to keep your repository tidy. |
0 commit comments