claude-agent-framework 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -0
- package/bin/claude-framework +3 -0
- package/framework/agents/design-lead.md +240 -0
- package/framework/agents/product-owner.md +179 -0
- package/framework/agents/tech-lead.md +226 -0
- package/framework/commands/ayuda.md +127 -0
- package/framework/commands/a/303/261adir.md +98 -0
- package/framework/commands/backup.md +397 -0
- package/framework/commands/cambiar.md +110 -0
- package/framework/commands/cloud.md +457 -0
- package/framework/commands/code.md +142 -0
- package/framework/commands/debug.md +334 -0
- package/framework/commands/deploy.md +383 -0
- package/framework/commands/deshacer.md +120 -0
- package/framework/commands/estado.md +218 -0
- package/framework/commands/explica.md +227 -0
- package/framework/commands/feature.md +120 -0
- package/framework/commands/git.md +427 -0
- package/framework/commands/historial.md +202 -0
- package/framework/commands/learn.md +408 -0
- package/framework/commands/movil.md +245 -0
- package/framework/commands/nuevo.md +118 -0
- package/framework/commands/plan.md +134 -0
- package/framework/commands/prd.md +113 -0
- package/framework/commands/probar.md +148 -0
- package/framework/commands/revisar.md +208 -0
- package/framework/commands/seeds.md +230 -0
- package/framework/commands/seguridad.md +226 -0
- package/framework/commands/tasks.md +157 -0
- package/framework/skills/architecture/algorithms.md +970 -0
- package/framework/skills/architecture/clean-code.md +1080 -0
- package/framework/skills/architecture/design-patterns.md +1984 -0
- package/framework/skills/architecture/functional-programming.md +972 -0
- package/framework/skills/architecture/solid.md +991 -0
- package/framework/skills/cloud/cloud-aws.md +848 -0
- package/framework/skills/cloud/cloud-azure.md +931 -0
- package/framework/skills/cloud/cloud-gcp.md +848 -0
- package/framework/skills/cloud/message-queues.md +1229 -0
- package/framework/skills/core/accessibility.md +401 -0
- package/framework/skills/core/api.md +474 -0
- package/framework/skills/core/authentication.md +306 -0
- package/framework/skills/core/authorization.md +388 -0
- package/framework/skills/core/background-jobs.md +341 -0
- package/framework/skills/core/caching.md +473 -0
- package/framework/skills/core/code-review.md +341 -0
- package/framework/skills/core/controllers.md +290 -0
- package/framework/skills/core/cua.md +285 -0
- package/framework/skills/core/documentation.md +472 -0
- package/framework/skills/core/file-uploads.md +351 -0
- package/framework/skills/core/hotwire-native.md +296 -0
- package/framework/skills/core/hotwire.md +278 -0
- package/framework/skills/core/i18n.md +334 -0
- package/framework/skills/core/imports-exports.md +750 -0
- package/framework/skills/core/infrastructure.md +337 -0
- package/framework/skills/core/models.md +228 -0
- package/framework/skills/core/notifications.md +672 -0
- package/framework/skills/core/payments.md +581 -0
- package/framework/skills/core/performance.md +361 -0
- package/framework/skills/core/rails-scaffold.md +131 -0
- package/framework/skills/core/search.md +518 -0
- package/framework/skills/core/security.md +565 -0
- package/framework/skills/core/seeds.md +307 -0
- package/framework/skills/core/seo.md +542 -0
- package/framework/skills/core/testing.md +393 -0
- package/framework/skills/core/views.md +260 -0
- package/framework/skills/core/websockets.md +564 -0
- package/framework/skills/data/advanced-sql.md +1204 -0
- package/framework/skills/data/nosql.md +1141 -0
- package/framework/skills/devops/containers-advanced.md +1237 -0
- package/framework/skills/devops/debugging.md +834 -0
- package/framework/skills/devops/git-workflow.md +752 -0
- package/framework/skills/devops/networking.md +932 -0
- package/framework/skills/devops/shell-scripting.md +1132 -0
- package/framework/sub-agents/architecture-patterns-agent.md +1450 -0
- package/framework/sub-agents/cloud-agent.md +677 -0
- package/framework/sub-agents/data.md +504 -0
- package/framework/sub-agents/debugging-agent.md +554 -0
- package/framework/sub-agents/devops.md +483 -0
- package/framework/sub-agents/docs.md +176 -0
- package/framework/sub-agents/frontend-dev.md +349 -0
- package/framework/sub-agents/git-workflow-agent.md +697 -0
- package/framework/sub-agents/integrations.md +630 -0
- package/framework/sub-agents/native-dev.md +434 -0
- package/framework/sub-agents/qa.md +138 -0
- package/framework/sub-agents/rails-dev.md +375 -0
- package/framework/sub-agents/security.md +526 -0
- package/framework/sub-agents/ui.md +437 -0
- package/framework/sub-agents/ux.md +284 -0
- package/framework/templates/api-spec.md +500 -0
- package/framework/templates/component-spec.md +248 -0
- package/framework/templates/feature.json +13 -0
- package/framework/templates/model-spec.md +318 -0
- package/framework/templates/prd-template.md +80 -0
- package/framework/templates/task-plan.md +122 -0
- package/framework/templates/task-user-story.md +52 -0
- package/framework/templates/technical-spec.md +260 -0
- package/framework/templates/user-story.md +95 -0
- package/package.json +42 -0
- package/project-templates/CLAUDE.md +42 -0
- package/project-templates/contexts/architecture.md +25 -0
- package/project-templates/contexts/conventions.md +46 -0
- package/project-templates/contexts/design-system.md +47 -0
- package/project-templates/contexts/requirements.md +38 -0
- package/project-templates/contexts/stack.md +30 -0
- package/project-templates/history/active/models.md +11 -0
- package/project-templates/history/changelog.md +15 -0
- package/project-templates/workspace/.gitkeep +0 -0
- package/src/cli.js +52 -0
- package/src/init.js +104 -0
- package/src/status.js +75 -0
- package/src/update.js +88 -0
|
@@ -0,0 +1,752 @@
|
|
|
1
|
+
# Skill: Git Workflow
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Gestionar control de versiones con Git siguiendo mejores prácticas de branching, commits convencionales y colaboración efectiva en equipos.
|
|
6
|
+
|
|
7
|
+
## Branching Strategies
|
|
8
|
+
|
|
9
|
+
### Git Flow
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
main (producción)
|
|
13
|
+
│
|
|
14
|
+
└── develop (integración)
|
|
15
|
+
│
|
|
16
|
+
├── feature/nueva-funcionalidad
|
|
17
|
+
├── feature/otra-funcionalidad
|
|
18
|
+
│
|
|
19
|
+
└── release/1.0.0
|
|
20
|
+
│
|
|
21
|
+
└── hotfix/fix-critico → main + develop
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Crear feature branch
|
|
26
|
+
git checkout develop
|
|
27
|
+
git checkout -b feature/user-registration
|
|
28
|
+
|
|
29
|
+
# Trabajar en feature
|
|
30
|
+
git add .
|
|
31
|
+
git commit -m "feat: add user registration form"
|
|
32
|
+
|
|
33
|
+
# Finalizar feature
|
|
34
|
+
git checkout develop
|
|
35
|
+
git merge --no-ff feature/user-registration
|
|
36
|
+
git branch -d feature/user-registration
|
|
37
|
+
|
|
38
|
+
# Crear release
|
|
39
|
+
git checkout develop
|
|
40
|
+
git checkout -b release/1.0.0
|
|
41
|
+
# Hacer ajustes finales...
|
|
42
|
+
git checkout main
|
|
43
|
+
git merge --no-ff release/1.0.0
|
|
44
|
+
git tag -a v1.0.0 -m "Release 1.0.0"
|
|
45
|
+
git checkout develop
|
|
46
|
+
git merge --no-ff release/1.0.0
|
|
47
|
+
|
|
48
|
+
# Hotfix urgente
|
|
49
|
+
git checkout main
|
|
50
|
+
git checkout -b hotfix/security-patch
|
|
51
|
+
# Aplicar fix...
|
|
52
|
+
git checkout main
|
|
53
|
+
git merge --no-ff hotfix/security-patch
|
|
54
|
+
git tag -a v1.0.1 -m "Security patch"
|
|
55
|
+
git checkout develop
|
|
56
|
+
git merge --no-ff hotfix/security-patch
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### GitHub Flow (Simplificado)
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Siempre desde main
|
|
63
|
+
git checkout main
|
|
64
|
+
git pull origin main
|
|
65
|
+
git checkout -b feature/add-comments
|
|
66
|
+
|
|
67
|
+
# Trabajar y commitear
|
|
68
|
+
git add .
|
|
69
|
+
git commit -m "feat: add comment system"
|
|
70
|
+
git push -u origin feature/add-comments
|
|
71
|
+
|
|
72
|
+
# Crear Pull Request en GitHub
|
|
73
|
+
# Después de review y merge, eliminar branch
|
|
74
|
+
git checkout main
|
|
75
|
+
git pull origin main
|
|
76
|
+
git branch -d feature/add-comments
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Trunk-Based Development
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Commits pequeños directo a main
|
|
83
|
+
git checkout main
|
|
84
|
+
git pull origin main
|
|
85
|
+
|
|
86
|
+
# Cambio pequeño y atómico
|
|
87
|
+
git add .
|
|
88
|
+
git commit -m "feat: add email validation"
|
|
89
|
+
git push origin main
|
|
90
|
+
|
|
91
|
+
# Para cambios grandes: feature flags
|
|
92
|
+
# config/features.yml
|
|
93
|
+
# new_checkout: false
|
|
94
|
+
|
|
95
|
+
# En código
|
|
96
|
+
if Feature.enabled?(:new_checkout)
|
|
97
|
+
# nuevo código
|
|
98
|
+
else
|
|
99
|
+
# código actual
|
|
100
|
+
end
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Conventional Commits
|
|
104
|
+
|
|
105
|
+
### Formato
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
<type>(<scope>): <description>
|
|
109
|
+
|
|
110
|
+
[optional body]
|
|
111
|
+
|
|
112
|
+
[optional footer(s)]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Tipos
|
|
116
|
+
|
|
117
|
+
| Tipo | Descripción | Ejemplo |
|
|
118
|
+
|------|-------------|---------|
|
|
119
|
+
| `feat` | Nueva funcionalidad | `feat: add user avatar upload` |
|
|
120
|
+
| `fix` | Corrección de bug | `fix: resolve login redirect loop` |
|
|
121
|
+
| `docs` | Documentación | `docs: update API endpoints` |
|
|
122
|
+
| `style` | Formato (no afecta código) | `style: fix indentation in user.rb` |
|
|
123
|
+
| `refactor` | Refactoring (sin cambio funcional) | `refactor: extract email service` |
|
|
124
|
+
| `perf` | Mejora de rendimiento | `perf: add database index for users` |
|
|
125
|
+
| `test` | Añadir/corregir tests | `test: add specs for payment flow` |
|
|
126
|
+
| `build` | Sistema de build | `build: update webpack config` |
|
|
127
|
+
| `ci` | Integración continua | `ci: add GitHub Actions workflow` |
|
|
128
|
+
| `chore` | Tareas de mantenimiento | `chore: update dependencies` |
|
|
129
|
+
| `revert` | Revertir commit | `revert: feat: add user avatar` |
|
|
130
|
+
|
|
131
|
+
### Ejemplos completos
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Feature simple
|
|
135
|
+
git commit -m "feat: add password strength indicator"
|
|
136
|
+
|
|
137
|
+
# Feature con scope
|
|
138
|
+
git commit -m "feat(auth): implement two-factor authentication"
|
|
139
|
+
|
|
140
|
+
# Fix con referencia a issue
|
|
141
|
+
git commit -m "fix(checkout): resolve cart total calculation
|
|
142
|
+
|
|
143
|
+
The total was not including shipping costs when
|
|
144
|
+
the user selected express delivery.
|
|
145
|
+
|
|
146
|
+
Fixes #123"
|
|
147
|
+
|
|
148
|
+
# Breaking change
|
|
149
|
+
git commit -m "feat(api)!: change response format to JSON:API
|
|
150
|
+
|
|
151
|
+
BREAKING CHANGE: API responses now follow JSON:API spec.
|
|
152
|
+
Update your client code accordingly."
|
|
153
|
+
|
|
154
|
+
# Múltiples párrafos
|
|
155
|
+
git commit -m "refactor(models): extract validation logic
|
|
156
|
+
|
|
157
|
+
- Move email validation to EmailValidator
|
|
158
|
+
- Move phone validation to PhoneValidator
|
|
159
|
+
- Add shared validation helpers
|
|
160
|
+
|
|
161
|
+
This makes validators reusable across models."
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Pull Request Best Practices
|
|
165
|
+
|
|
166
|
+
### Template de PR
|
|
167
|
+
|
|
168
|
+
```markdown
|
|
169
|
+
<!-- .github/pull_request_template.md -->
|
|
170
|
+
## Descripción
|
|
171
|
+
<!-- Qué cambia este PR y por qué -->
|
|
172
|
+
|
|
173
|
+
## Tipo de cambio
|
|
174
|
+
- [ ] Bug fix (cambio que soluciona un issue)
|
|
175
|
+
- [ ] Nueva feature (cambio que añade funcionalidad)
|
|
176
|
+
- [ ] Breaking change (fix o feature que rompe compatibilidad)
|
|
177
|
+
- [ ] Refactoring (mejora sin cambio funcional)
|
|
178
|
+
|
|
179
|
+
## Checklist
|
|
180
|
+
- [ ] Mi código sigue el estilo del proyecto
|
|
181
|
+
- [ ] He hecho self-review de mi código
|
|
182
|
+
- [ ] He comentado código complejo
|
|
183
|
+
- [ ] He actualizado la documentación
|
|
184
|
+
- [ ] Mis cambios no generan warnings
|
|
185
|
+
- [ ] He añadido tests que prueban mi fix/feature
|
|
186
|
+
- [ ] Tests nuevos y existentes pasan localmente
|
|
187
|
+
|
|
188
|
+
## Screenshots (si aplica)
|
|
189
|
+
<!-- Añadir capturas de UI changes -->
|
|
190
|
+
|
|
191
|
+
## Testing
|
|
192
|
+
<!-- Cómo probar estos cambios -->
|
|
193
|
+
|
|
194
|
+
## Issues relacionados
|
|
195
|
+
Closes #123
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Buenos títulos de PR
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
feat(users): add profile photo upload
|
|
202
|
+
fix(payments): handle failed webhook signatures
|
|
203
|
+
docs(api): document rate limiting headers
|
|
204
|
+
refactor(orders): extract shipping calculator
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Merge Strategies
|
|
208
|
+
|
|
209
|
+
### Merge Commit (--no-ff)
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# Mantiene historial completo
|
|
213
|
+
git checkout main
|
|
214
|
+
git merge --no-ff feature/user-auth
|
|
215
|
+
|
|
216
|
+
# Resultado:
|
|
217
|
+
# * Merge branch 'feature/user-auth'
|
|
218
|
+
# |\
|
|
219
|
+
# | * feat: add password reset
|
|
220
|
+
# | * feat: add login form
|
|
221
|
+
# |/
|
|
222
|
+
# * previous commit
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Squash Merge
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# Combina todos los commits en uno
|
|
229
|
+
git checkout main
|
|
230
|
+
git merge --squash feature/user-auth
|
|
231
|
+
git commit -m "feat(auth): add complete user authentication"
|
|
232
|
+
|
|
233
|
+
# Resultado:
|
|
234
|
+
# * feat(auth): add complete user authentication
|
|
235
|
+
# * previous commit
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Rebase
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
# Reescribe historial para ser lineal
|
|
242
|
+
git checkout feature/user-auth
|
|
243
|
+
git rebase main
|
|
244
|
+
git checkout main
|
|
245
|
+
git merge feature/user-auth
|
|
246
|
+
|
|
247
|
+
# Resultado (lineal):
|
|
248
|
+
# * feat: add password reset
|
|
249
|
+
# * feat: add login form
|
|
250
|
+
# * previous commit
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Cuándo usar cada uno
|
|
254
|
+
|
|
255
|
+
| Estrategia | Cuándo usar |
|
|
256
|
+
|------------|-------------|
|
|
257
|
+
| Merge commit | Features grandes, mantener contexto |
|
|
258
|
+
| Squash | Features pequeñas, limpiar WIP commits |
|
|
259
|
+
| Rebase | Mantener historial limpio y lineal |
|
|
260
|
+
|
|
261
|
+
## Git Hooks
|
|
262
|
+
|
|
263
|
+
### Pre-commit (Rubocop + Format)
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
#!/bin/sh
|
|
267
|
+
# .git/hooks/pre-commit
|
|
268
|
+
|
|
269
|
+
echo "Running Rubocop..."
|
|
270
|
+
bundle exec rubocop --autocorrect-all
|
|
271
|
+
|
|
272
|
+
if [ $? -ne 0 ]; then
|
|
273
|
+
echo "Rubocop failed. Please fix the issues before committing."
|
|
274
|
+
exit 1
|
|
275
|
+
fi
|
|
276
|
+
|
|
277
|
+
echo "Running ERB Lint..."
|
|
278
|
+
bundle exec erblint --lint-all --autocorrect
|
|
279
|
+
|
|
280
|
+
# Re-add any auto-corrected files
|
|
281
|
+
git add -u
|
|
282
|
+
|
|
283
|
+
exit 0
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Pre-push (Tests)
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
#!/bin/sh
|
|
290
|
+
# .git/hooks/pre-push
|
|
291
|
+
|
|
292
|
+
echo "Running tests before push..."
|
|
293
|
+
bundle exec rspec --fail-fast
|
|
294
|
+
|
|
295
|
+
if [ $? -ne 0 ]; then
|
|
296
|
+
echo "Tests failed. Push aborted."
|
|
297
|
+
exit 1
|
|
298
|
+
fi
|
|
299
|
+
|
|
300
|
+
echo "Running Brakeman..."
|
|
301
|
+
bundle exec brakeman -q -w2
|
|
302
|
+
|
|
303
|
+
if [ $? -ne 0 ]; then
|
|
304
|
+
echo "Security issues found. Push aborted."
|
|
305
|
+
exit 1
|
|
306
|
+
fi
|
|
307
|
+
|
|
308
|
+
exit 0
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Commit-msg (Validar formato)
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
#!/bin/sh
|
|
315
|
+
# .git/hooks/commit-msg
|
|
316
|
+
|
|
317
|
+
commit_regex='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?: .{1,72}'
|
|
318
|
+
|
|
319
|
+
if ! grep -qE "$commit_regex" "$1"; then
|
|
320
|
+
echo "Invalid commit message format."
|
|
321
|
+
echo "Must match: type(scope): description"
|
|
322
|
+
echo "Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert"
|
|
323
|
+
exit 1
|
|
324
|
+
fi
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### Instalar hooks con Overcommit
|
|
328
|
+
|
|
329
|
+
```ruby
|
|
330
|
+
# Gemfile
|
|
331
|
+
group :development do
|
|
332
|
+
gem "overcommit"
|
|
333
|
+
end
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
```yaml
|
|
337
|
+
# .overcommit.yml
|
|
338
|
+
PreCommit:
|
|
339
|
+
RuboCop:
|
|
340
|
+
enabled: true
|
|
341
|
+
command: ['bundle', 'exec', 'rubocop']
|
|
342
|
+
on_warn: fail
|
|
343
|
+
|
|
344
|
+
ErbLint:
|
|
345
|
+
enabled: true
|
|
346
|
+
command: ['bundle', 'exec', 'erblint']
|
|
347
|
+
|
|
348
|
+
PrePush:
|
|
349
|
+
RSpec:
|
|
350
|
+
enabled: true
|
|
351
|
+
command: ['bundle', 'exec', 'rspec', '--fail-fast']
|
|
352
|
+
|
|
353
|
+
Brakeman:
|
|
354
|
+
enabled: true
|
|
355
|
+
command: ['bundle', 'exec', 'brakeman', '-q', '-w2']
|
|
356
|
+
|
|
357
|
+
CommitMsg:
|
|
358
|
+
MessageFormat:
|
|
359
|
+
enabled: true
|
|
360
|
+
pattern: '^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?: .+'
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
overcommit --install
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## Comandos Útiles
|
|
368
|
+
|
|
369
|
+
### Stash
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
# Guardar cambios temporalmente
|
|
373
|
+
git stash
|
|
374
|
+
git stash push -m "WIP: user registration"
|
|
375
|
+
|
|
376
|
+
# Listar stashes
|
|
377
|
+
git stash list
|
|
378
|
+
|
|
379
|
+
# Aplicar último stash
|
|
380
|
+
git stash pop
|
|
381
|
+
|
|
382
|
+
# Aplicar stash específico
|
|
383
|
+
git stash apply stash@{2}
|
|
384
|
+
|
|
385
|
+
# Stash parcial (interactivo)
|
|
386
|
+
git stash push -p
|
|
387
|
+
|
|
388
|
+
# Stash incluyendo untracked
|
|
389
|
+
git stash -u
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Cherry-pick
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
# Aplicar commit específico a otra rama
|
|
396
|
+
git checkout main
|
|
397
|
+
git cherry-pick abc123
|
|
398
|
+
|
|
399
|
+
# Cherry-pick sin commitear
|
|
400
|
+
git cherry-pick --no-commit abc123
|
|
401
|
+
|
|
402
|
+
# Cherry-pick rango de commits
|
|
403
|
+
git cherry-pick abc123..def456
|
|
404
|
+
|
|
405
|
+
# Resolver conflictos y continuar
|
|
406
|
+
git cherry-pick --continue
|
|
407
|
+
|
|
408
|
+
# Abortar cherry-pick
|
|
409
|
+
git cherry-pick --abort
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### Rebase Interactivo
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
# Editar últimos 3 commits
|
|
416
|
+
git rebase -i HEAD~3
|
|
417
|
+
|
|
418
|
+
# Comandos en editor:
|
|
419
|
+
# pick abc123 feat: first commit (mantener)
|
|
420
|
+
# squash def456 fix: typo (combinar con anterior)
|
|
421
|
+
# reword ghi789 docs: update (cambiar mensaje)
|
|
422
|
+
# drop jkl012 WIP (eliminar)
|
|
423
|
+
# edit mno345 feat: needs split (pausar para editar)
|
|
424
|
+
|
|
425
|
+
# Reordenar commits: simplemente mover líneas
|
|
426
|
+
|
|
427
|
+
# Después de edit:
|
|
428
|
+
git add .
|
|
429
|
+
git commit --amend
|
|
430
|
+
git rebase --continue
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### Bisect (encontrar commit problemático)
|
|
434
|
+
|
|
435
|
+
```bash
|
|
436
|
+
# Iniciar bisect
|
|
437
|
+
git bisect start
|
|
438
|
+
|
|
439
|
+
# Marcar commit actual como malo
|
|
440
|
+
git bisect bad
|
|
441
|
+
|
|
442
|
+
# Marcar commit bueno conocido
|
|
443
|
+
git bisect good v1.0.0
|
|
444
|
+
|
|
445
|
+
# Git hace checkout de commit intermedio
|
|
446
|
+
# Probar si el bug existe...
|
|
447
|
+
git bisect good # o git bisect bad
|
|
448
|
+
|
|
449
|
+
# Repetir hasta encontrar el commit culpable
|
|
450
|
+
|
|
451
|
+
# Finalizar
|
|
452
|
+
git bisect reset
|
|
453
|
+
|
|
454
|
+
# Bisect automático con script
|
|
455
|
+
git bisect start HEAD v1.0.0
|
|
456
|
+
git bisect run bundle exec rspec spec/models/user_spec.rb
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
### Reflog (recuperar commits perdidos)
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
# Ver historial de HEAD
|
|
463
|
+
git reflog
|
|
464
|
+
|
|
465
|
+
# Ver reflog de rama específica
|
|
466
|
+
git reflog show feature/user
|
|
467
|
+
|
|
468
|
+
# Recuperar commit después de reset --hard
|
|
469
|
+
git reflog
|
|
470
|
+
# abc123 HEAD@{2}: commit: feat: important change
|
|
471
|
+
git checkout abc123
|
|
472
|
+
# o
|
|
473
|
+
git branch recovered-branch abc123
|
|
474
|
+
|
|
475
|
+
# Recuperar rama eliminada
|
|
476
|
+
git reflog
|
|
477
|
+
# def456 HEAD@{5}: checkout: moving from deleted-branch to main
|
|
478
|
+
git checkout -b deleted-branch def456
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
### Otros comandos útiles
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
# Ver diferencias de un archivo específico
|
|
485
|
+
git diff HEAD~3..HEAD -- app/models/user.rb
|
|
486
|
+
|
|
487
|
+
# Blame con ignore de whitespace
|
|
488
|
+
git blame -w app/models/user.rb
|
|
489
|
+
|
|
490
|
+
# Log de un archivo
|
|
491
|
+
git log --follow -p -- app/models/user.rb
|
|
492
|
+
|
|
493
|
+
# Buscar en historial
|
|
494
|
+
git log -S "método_buscado" --oneline
|
|
495
|
+
|
|
496
|
+
# Ver branches mergeadas
|
|
497
|
+
git branch --merged main
|
|
498
|
+
|
|
499
|
+
# Limpiar branches mergeadas
|
|
500
|
+
git branch --merged main | grep -v main | xargs git branch -d
|
|
501
|
+
|
|
502
|
+
# Verificar qué se va a pushear
|
|
503
|
+
git log origin/main..HEAD
|
|
504
|
+
|
|
505
|
+
# Reset archivo a versión específica
|
|
506
|
+
git checkout abc123 -- app/models/user.rb
|
|
507
|
+
|
|
508
|
+
# Unstage archivos
|
|
509
|
+
git reset HEAD app/models/user.rb
|
|
510
|
+
|
|
511
|
+
# Descartar cambios locales
|
|
512
|
+
git checkout -- app/models/user.rb
|
|
513
|
+
|
|
514
|
+
# Amend sin cambiar mensaje
|
|
515
|
+
git commit --amend --no-edit
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
## Resolución de Conflictos
|
|
519
|
+
|
|
520
|
+
### Estrategias
|
|
521
|
+
|
|
522
|
+
```bash
|
|
523
|
+
# Ver archivos en conflicto
|
|
524
|
+
git status
|
|
525
|
+
|
|
526
|
+
# Abrir herramienta de merge
|
|
527
|
+
git mergetool
|
|
528
|
+
|
|
529
|
+
# Aceptar versión nuestra
|
|
530
|
+
git checkout --ours app/models/user.rb
|
|
531
|
+
|
|
532
|
+
# Aceptar versión de ellos
|
|
533
|
+
git checkout --theirs app/models/user.rb
|
|
534
|
+
|
|
535
|
+
# Marcar como resuelto
|
|
536
|
+
git add app/models/user.rb
|
|
537
|
+
git commit
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
### Anatomía de un conflicto
|
|
541
|
+
|
|
542
|
+
```ruby
|
|
543
|
+
# app/models/user.rb
|
|
544
|
+
<<<<<<< HEAD
|
|
545
|
+
def full_name
|
|
546
|
+
"#{first_name} #{last_name}"
|
|
547
|
+
end
|
|
548
|
+
=======
|
|
549
|
+
def full_name
|
|
550
|
+
[first_name, middle_name, last_name].compact.join(" ")
|
|
551
|
+
end
|
|
552
|
+
>>>>>>> feature/add-middle-name
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### Resolver manualmente
|
|
556
|
+
|
|
557
|
+
```ruby
|
|
558
|
+
# Elegir/combinar el código correcto:
|
|
559
|
+
def full_name
|
|
560
|
+
[first_name, middle_name, last_name].compact.join(" ")
|
|
561
|
+
end
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
```bash
|
|
565
|
+
git add app/models/user.rb
|
|
566
|
+
git commit -m "fix: merge conflict in user full_name"
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
## .gitignore para Rails
|
|
570
|
+
|
|
571
|
+
```gitignore
|
|
572
|
+
# .gitignore
|
|
573
|
+
|
|
574
|
+
# Bundler
|
|
575
|
+
/.bundle
|
|
576
|
+
/vendor/bundle
|
|
577
|
+
|
|
578
|
+
# SQLite
|
|
579
|
+
/storage/*.sqlite3
|
|
580
|
+
/storage/*.sqlite3-*
|
|
581
|
+
|
|
582
|
+
# Environment
|
|
583
|
+
.env
|
|
584
|
+
.env.local
|
|
585
|
+
.env.*.local
|
|
586
|
+
|
|
587
|
+
# Logs
|
|
588
|
+
/log/*
|
|
589
|
+
!/log/.keep
|
|
590
|
+
|
|
591
|
+
# Temp files
|
|
592
|
+
/tmp/*
|
|
593
|
+
!/tmp/.keep
|
|
594
|
+
!/tmp/pids
|
|
595
|
+
!/tmp/pids/.keep
|
|
596
|
+
|
|
597
|
+
# Node modules
|
|
598
|
+
/node_modules
|
|
599
|
+
|
|
600
|
+
# Assets
|
|
601
|
+
/public/assets
|
|
602
|
+
/public/packs
|
|
603
|
+
/public/packs-test
|
|
604
|
+
|
|
605
|
+
# Coverage
|
|
606
|
+
/coverage
|
|
607
|
+
|
|
608
|
+
# OS files
|
|
609
|
+
.DS_Store
|
|
610
|
+
Thumbs.db
|
|
611
|
+
|
|
612
|
+
# IDE
|
|
613
|
+
.idea/
|
|
614
|
+
.vscode/
|
|
615
|
+
*.swp
|
|
616
|
+
*.swo
|
|
617
|
+
*~
|
|
618
|
+
|
|
619
|
+
# Master key (IMPORTANTE)
|
|
620
|
+
/config/master.key
|
|
621
|
+
/config/credentials/*.key
|
|
622
|
+
|
|
623
|
+
# Byebug
|
|
624
|
+
.byebug_history
|
|
625
|
+
|
|
626
|
+
# Spring
|
|
627
|
+
/tmp/spring/
|
|
628
|
+
|
|
629
|
+
# Brakeman
|
|
630
|
+
/tmp/brakeman-report.*
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
## Semantic Versioning
|
|
634
|
+
|
|
635
|
+
### Formato: MAJOR.MINOR.PATCH
|
|
636
|
+
|
|
637
|
+
```
|
|
638
|
+
v2.1.3
|
|
639
|
+
│ │ └── PATCH: bug fixes (compatible)
|
|
640
|
+
│ └──── MINOR: new features (compatible)
|
|
641
|
+
└────── MAJOR: breaking changes (incompatible)
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
### Reglas
|
|
645
|
+
|
|
646
|
+
| Incrementar | Cuándo |
|
|
647
|
+
|-------------|--------|
|
|
648
|
+
| PATCH | Bug fixes sin cambios de API |
|
|
649
|
+
| MINOR | Nueva funcionalidad compatible hacia atrás |
|
|
650
|
+
| MAJOR | Cambios que rompen compatibilidad |
|
|
651
|
+
|
|
652
|
+
### Ejemplos
|
|
653
|
+
|
|
654
|
+
```bash
|
|
655
|
+
# Bug fix
|
|
656
|
+
v1.2.3 → v1.2.4
|
|
657
|
+
git tag -a v1.2.4 -m "Fix: resolve payment processing error"
|
|
658
|
+
|
|
659
|
+
# Nueva feature
|
|
660
|
+
v1.2.4 → v1.3.0
|
|
661
|
+
git tag -a v1.3.0 -m "Feature: add subscription management"
|
|
662
|
+
|
|
663
|
+
# Breaking change
|
|
664
|
+
v1.3.0 → v2.0.0
|
|
665
|
+
git tag -a v2.0.0 -m "BREAKING: new API response format"
|
|
666
|
+
|
|
667
|
+
# Pre-release
|
|
668
|
+
v2.0.0-alpha.1
|
|
669
|
+
v2.0.0-beta.1
|
|
670
|
+
v2.0.0-rc.1
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
### Tags en Git
|
|
674
|
+
|
|
675
|
+
```bash
|
|
676
|
+
# Crear tag anotado
|
|
677
|
+
git tag -a v1.0.0 -m "Release version 1.0.0"
|
|
678
|
+
|
|
679
|
+
# Listar tags
|
|
680
|
+
git tag -l "v1.*"
|
|
681
|
+
|
|
682
|
+
# Pushear tags
|
|
683
|
+
git push origin v1.0.0
|
|
684
|
+
git push origin --tags
|
|
685
|
+
|
|
686
|
+
# Eliminar tag
|
|
687
|
+
git tag -d v1.0.0
|
|
688
|
+
git push origin --delete v1.0.0
|
|
689
|
+
|
|
690
|
+
# Checkout a tag
|
|
691
|
+
git checkout v1.0.0
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
## Automatización con GitHub Actions
|
|
695
|
+
|
|
696
|
+
```yaml
|
|
697
|
+
# .github/workflows/release.yml
|
|
698
|
+
name: Release
|
|
699
|
+
|
|
700
|
+
on:
|
|
701
|
+
push:
|
|
702
|
+
tags:
|
|
703
|
+
- 'v*'
|
|
704
|
+
|
|
705
|
+
jobs:
|
|
706
|
+
release:
|
|
707
|
+
runs-on: ubuntu-latest
|
|
708
|
+
steps:
|
|
709
|
+
- uses: actions/checkout@v4
|
|
710
|
+
|
|
711
|
+
- name: Create Release
|
|
712
|
+
uses: actions/create-release@v1
|
|
713
|
+
env:
|
|
714
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
715
|
+
with:
|
|
716
|
+
tag_name: ${{ github.ref }}
|
|
717
|
+
release_name: Release ${{ github.ref }}
|
|
718
|
+
body: |
|
|
719
|
+
Changes in this release:
|
|
720
|
+
- Feature X
|
|
721
|
+
- Fix Y
|
|
722
|
+
draft: false
|
|
723
|
+
prerelease: false
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
## Workflow diario recomendado
|
|
727
|
+
|
|
728
|
+
```bash
|
|
729
|
+
# Empezar el día
|
|
730
|
+
git checkout main
|
|
731
|
+
git pull origin main
|
|
732
|
+
|
|
733
|
+
# Crear branch para trabajo
|
|
734
|
+
git checkout -b feature/mi-tarea
|
|
735
|
+
|
|
736
|
+
# Hacer commits frecuentes y pequeños
|
|
737
|
+
git add -p # Añadir por hunks
|
|
738
|
+
git commit -m "feat: add user validation"
|
|
739
|
+
|
|
740
|
+
# Sincronizar con main regularmente
|
|
741
|
+
git fetch origin
|
|
742
|
+
git rebase origin/main
|
|
743
|
+
|
|
744
|
+
# Al terminar
|
|
745
|
+
git push -u origin feature/mi-tarea
|
|
746
|
+
# Crear PR en GitHub
|
|
747
|
+
|
|
748
|
+
# Después del merge
|
|
749
|
+
git checkout main
|
|
750
|
+
git pull origin main
|
|
751
|
+
git branch -d feature/mi-tarea
|
|
752
|
+
```
|