83 lines
1.6 KiB
Markdown
83 lines
1.6 KiB
Markdown
|
|
# Contributing Guide
|
||
|
|
|
||
|
|
## Git Workflow
|
||
|
|
|
||
|
|
### Branch Strategy
|
||
|
|
|
||
|
|
| Branch Type | Naming | Purpose |
|
||
|
|
|-------------|--------|---------|
|
||
|
|
| `main` | `main` | Production-ready code |
|
||
|
|
| `develop` | `develop` | Integration branch for features |
|
||
|
|
| Feature | `feature/<name>` | New functionality |
|
||
|
|
| Hotfix | `hotfix/<name>` | Urgent bug fixes |
|
||
|
|
|
||
|
|
### Workflow
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Clone repository
|
||
|
|
git clone <repository-url>
|
||
|
|
cd GestionTablets
|
||
|
|
|
||
|
|
# Setup develop branch
|
||
|
|
git checkout -b develop
|
||
|
|
|
||
|
|
# Create feature branch
|
||
|
|
git checkout -b feature/my-feature
|
||
|
|
git push origin feature/my-feature
|
||
|
|
|
||
|
|
# Make changes, commit
|
||
|
|
git add .
|
||
|
|
git commit -m "feat: add my feature"
|
||
|
|
git push origin feature/my-feature
|
||
|
|
|
||
|
|
# Create Pull Request to develop
|
||
|
|
```
|
||
|
|
|
||
|
|
### Commit Message Format
|
||
|
|
|
||
|
|
```
|
||
|
|
type(scope): description
|
||
|
|
|
||
|
|
[optional body]
|
||
|
|
|
||
|
|
[optional footer]
|
||
|
|
```
|
||
|
|
|
||
|
|
**Types**:
|
||
|
|
- `feat`: New feature
|
||
|
|
- `fix`: Bug fix
|
||
|
|
- `docs`: Documentation changes
|
||
|
|
- `refactor`: Code refactoring
|
||
|
|
- `chore`: Maintenance tasks
|
||
|
|
- `test`: Test-related changes
|
||
|
|
|
||
|
|
**Examples**:
|
||
|
|
- `feat(loans): add user loans view page`
|
||
|
|
- `fix(tablet): validate serial number uniqueness`
|
||
|
|
- `docs: update README with database schema`
|
||
|
|
- `refactor(app): extract loan logic to service`
|
||
|
|
|
||
|
|
### Pull Request Process
|
||
|
|
|
||
|
|
1. Target `develop` branch (or `main` for hotfixes)
|
||
|
|
2. Include clear description of changes
|
||
|
|
3. Reference related issues
|
||
|
|
4. Wait for code review
|
||
|
|
5. Squash merge preferred
|
||
|
|
|
||
|
|
### Reverting Changes
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Discard unstaged changes
|
||
|
|
git checkout -- file.txt
|
||
|
|
|
||
|
|
# Unstage file
|
||
|
|
git reset HEAD file.txt
|
||
|
|
|
||
|
|
# Revert to previous commit (safe)
|
||
|
|
git revert HEAD
|
||
|
|
|
||
|
|
# Hard reset to commit (destructive)
|
||
|
|
git reset --hard <commit-hash>
|
||
|
|
```
|