Lo que lograrás
Al final de este tutorial habrás forkeado un repositorio open source, hecho un pequeño cambio en un branch feature, abierto un pull request, respondido al feedback, y visto tu trabajo mergeado.
Prerrequisitos
- Git instalado.
- Una cuenta GitHub.
- SSH o un personal access token configurado.
- Un repositorio objetivo.
Paso 1: forkea el repositorio
git clone [email protected]:yourname/project.git
cd project
Paso 2: añade upstream como remote
git remote add upstream [email protected]:original-owner/project.git
git remote -v
Paso 3: sincroniza desde upstream
git fetch upstream
git checkout main
git merge upstream/main --ff-only
git push origin main
Paso 4: crea un branch feature
git checkout -b fix/typo-in-readme
Paso 5: haz el cambio
git status
git diff
git add README.md
git commit -m "Fix typo in installation section"
Paso 6: pushea tu branch
git push -u origin fix/typo-in-readme
Paso 7: abre el pull request
gh pr create --title "Fix typo in installation section" \
--body "Fixes a small typo where 'isntall' should read 'install'."
Paso 8: responde al feedback
git add CONTRIBUTING.md
git commit -m "Fix same typo in CONTRIBUTING"
git push
Paso 9: maneja fallos de CI
Si CI está rojo, haz click hasta el run fallido, identifica el problema, arregla localmente, pushea de nuevo.
Paso 10: mergea
gh pr merge --squash --delete-branch
git checkout main
git fetch upstream
git merge upstream/main --ff-only
git push origin main
git branch -d fix/typo-in-readme
Trampas comunes para principiantes
- Trabajar directamente en
main. - Empaquetar cambios no relacionados en un PR.
- Pushear sin probar localmente.
- Force-push a
main.