34 lines
965 B
Markdown
34 lines
965 B
Markdown
## Branching in GitHub
|
|
|
|
### What is a Branch?
|
|
- A branch is a copy of the main codebase.
|
|
- Allows working on features without affecting main branch.
|
|
- Default branch is usually called main.
|
|
|
|
### Creating and Using Branches
|
|
- Branches are created from main.
|
|
- Changes in branches remain isolated until merged.
|
|
- Helps in experimentation and feature development.
|
|
|
|
### Commits
|
|
- A commit saves changes to the repository.
|
|
- Each commit has:
|
|
- Unique ID
|
|
- Commit message
|
|
- Commit messages explain why a change was made.
|
|
|
|
### Pull Requests (PR)
|
|
- A pull request proposes changes from one branch to another.
|
|
- Shows differences (diffs) between branches.
|
|
- Allows review and discussion before merging.
|
|
|
|
### Merging a Pull Request
|
|
- Combines branch changes into main.
|
|
- Conflicts must be resolved before merge.
|
|
- After merging, branches can be deleted safely.
|
|
|
|
### Benefits of Pull Requests
|
|
- Code review
|
|
- Quality control
|
|
- Clear change history
|
|
- Team collaboration |