add knowledge
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# Version Control
|
||||
|
||||
Track every change to your code, collaborate without stepping on each other, and roll back anything.
|
||||
|
||||
## Tools
|
||||
|
||||
**Git** is the universal standard. Pair it with a hosting platform for collaboration and access control.
|
||||
|
||||
| Platform | Self-hosted | Cloud |
|
||||
|---|---|---|
|
||||
| GitHub | — | github.com |
|
||||
| GitLab | yes | gitlab.com |
|
||||
| Gitea | yes | — |
|
||||
|
||||
## Key Concepts
|
||||
|
||||
- **Commit often** — small, atomic commits are easier to review and revert
|
||||
- **Branch per feature** — keeps main stable and deployable at all times
|
||||
- **Merge/rebase before pushing** — resolve conflicts locally, not in CI
|
||||
|
||||
## Quickstart
|
||||
|
||||
```bash
|
||||
git init
|
||||
git add .
|
||||
git commit -m "initial commit"
|
||||
|
||||
# branch workflow
|
||||
git checkout -b feature/my-thing
|
||||
# ... make changes ...
|
||||
git add -p # stage interactively
|
||||
git commit -m "feat: describe the change"
|
||||
git push origin feature/my-thing
|
||||
```
|
||||
|
||||
## Minimal Config
|
||||
|
||||
```bash
|
||||
git config --global user.name "Your Name"
|
||||
git config --global user.email "you@example.com"
|
||||
git config --global init.defaultBranch main
|
||||
git config --global pull.rebase true
|
||||
```
|
||||
|
||||
## Helpful tools
|
||||
|
||||
- `lazygit`
|
||||
- VSCode Git Graph extension
|
||||
Reference in New Issue
Block a user