Commandes Git pour les contributeurs
Cette page a été traduite par PageTurner AI (bêta). Non approuvée officiellement par le projet. Vous avez trouvé une erreur ? Signaler un problème →
Bien que nous soyons habitués au contrôle de source, travailler avec un fork et garantir des fusions fluides présente des défis supplémentaires. Cette page vous aide à accomplir les tâches qu'on pourrait vous demander, mais qui sortent de votre zone de confort.
Installez-vous confortablement, détendez-vous et prenez votre serviette.
Si vous n'êtes pas à l'aise avec Git en CLI, nous recommandons GitKraken. C'est le meilleur outil Git multiplateforme et nous avons ajouté ci-dessous des instructions pour son utilisation.
Je n'ai pas respecté les conventions de commit
- 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.
Ma branche n'est pas à jour avec le dépôt distant
Cela signifie que la branche principale d'oh-my-posh contient des commits absents de votre branche (votre branche principale ou celle de travail). Pour y remédier, il faut effectuer un rebase (ajouter les nouveaux commits d'oh-my-posh sous vos commits) afin que la pull request soit fusionnable.
Commencez par ajouter le dépôt oh-my-posh comme remote à votre dépôt Git local. Par défaut, votre fork est une copie autonome d'oh-my-posh avec son propre remote sur GitHub, non connecté au dépôt original. Les forks et pull requests sont des fonctionnalités ajoutées par GitHub par-dessus Git, nous devons donc recréer cette configuration manuellement.
Ajouter le remote à votre dépôt Git 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
Rebasez votre branche sur 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