Comandos Git para colaboradores
Esta página fue traducida por PageTurner AI (beta). No está respaldada oficialmente por el proyecto. ¿Encontraste un error? Reportar problema →
Aunque normalmente trabajamos con control de versiones, usar una bifurcación y asegurarnos de poder fusionar cambios rápidamente presenta desafíos adicionales. Esta página te ayudará con las tareas que podrían solicitarte, pero que quizás no formen parte de tu flujo habitual.
Siéntate, relájate y ten tu toalla a mano.
Si no te sientes cómodo usando git desde la CLI, recomendamos GitKraken. Es la mejor herramienta git multiplataforma y también hemos incluido instrucciones sobre cómo usarlo más abajo.
No seguí las pautas de commits convencionales
- GitKraken
- CLI
Open your oh-my-posh repo inside GitKraken and right click the commit you want to reword in the graph overview.
Select Edit commit message, reword it to respect the conventional commit guidelines and press Update message.
Click Push on the top of the screen and select Force Push to bring the changes to the Pull Request.
I only have 1 commit
To reword the last commit, we can make use of git's --amend switch to add something to our latest commit (code, changes, rewording).
Use the following commands to rephrase the last commit and get that change merged!
git commit --amend -m "feat: better worded feature"`
git push --force
I added more than commit
If all of your commits need to go to main because it makes sense to treat these as atomic units, you can use git's interactive rebase
functionality to reword any commit between main and your HEAD. To start an interactive rebase, type git rebase -i main.
This will open your $EDITOR and you can mark the commits you want to reword with reword (or r) rather than pick.
Exiting that file will start the rebase and spawn your $EDITOR to alter the commit message for each commit you marked as reword.
Once done, use git push --force to bring the changes to the pull request.
The latest version of vscode has a built-in gui to help you select reword or any other action on a commit. Select the right ones and press
Start Rebase to continue.
Mi rama está desactualizada respecto al remoto
Esto significa que la rama principal de oh-my-posh contiene commits que tu rama no tiene (podría ser tu rama principal o la rama que creaste para trabajar). Para solucionarlo, necesitamos reorganizar (rebase) tu rama (agregar los nuevos commits de la rama principal de oh-my-posh debajo de tus nuevos commits) para que la pull request pueda fusionarse.
Lo primero es agregar el repositorio de oh-my-posh como remoto en tu copia local. Por defecto, tu bifurcación es una copia independiente de oh-my-posh con su propio remoto en GitHub que no está conectado al repositorio original. Las bifurcaciones (forks) y pull requests son funcionalidades que GitHub añade sobre git, así que necesitamos recrear esa configuración manualmente.
Agregar el remoto a tu repositorio local
- GitKraken
- CLI
Hover over Remote on the left-hand side, this will show a + button. Click it and select GitHub. There you have the ability to select
jandedobbeleer/oh-my-posh and name it upstream. GitKraken will fetch the remote and you will see all branches underneath upstream as
you do for your own branches. Right click upstream's main branch and select Rebase <branch> onto upstream/main.
Click Push on the top of the screen and select Force Push to bring the changes to the Pull Request.
git remote add upstream git@github.com:JanDeDobbeleer/oh-my-posh.git
git fetch upstream
Reorganizar tu rama sobre upstream/main
- GitKraken
- CLI
Right click upstream's main branch and select Rebase <branch> onto upstream/main. Click Push on the top of the screen and select
Force Push to bring the changes to the Pull Request.
git rebase upstream/main
git push --force