Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
| info:git:homepage [2023/09/05 08:20] – [clés ssh] radeff | info:git:homepage [2025/12/11 14:00] (Version actuelle) – radeff | ||
|---|---|---|---|
| Ligne 33: | Ligne 33: | ||
| branch = auto | branch = auto | ||
| [user] | [user] | ||
| - | name = zpartakov | + | name = johndoe |
| - | email = zpartakov@akademia.ch | + | email = johndoe@coincoin.org |
| [alias] | [alias] | ||
| ci = commit | ci = commit | ||
| Ligne 61: | Ligne 61: | ||
| fork then | fork then | ||
| - | git remote add origin git@github.com: | + | git remote add origin git@gitlab.com: |
| < | < | ||
| - | git pull git@github.com: | + | git pull git@gitlab.com: |
| git st | git st | ||
| git add... | git add... | ||
| hg commit -m " | hg commit -m " | ||
| - | git push git@github.com: | + | git push git@gitlab.com: |
| - | https://github.com/ | + | https://gitlab.com/ |
| git log | git log | ||
| #details d'un commit | #details d'un commit | ||
| git show 0943dce3be9c4a0f21c397f62ea18f78a4bcea26 | git show 0943dce3be9c4a0f21c397f62ea18f78a4bcea26 | ||
| </ | </ | ||
| - | ===== Rollback | + | ===== Branch |
| - | Revenir en arrière d'un commit | + | lister les branches: |
| + | git branch | ||
| + | ensuite changer de branche avec: | ||
| + | git checkout < | ||
| + | ===== Reset (rollback) ===== | ||
| + | <note warning> | ||
| + | |||
| + | **Revenir en arrière d'un commit** | ||
| git reset --hard HEAD^ | git reset --hard HEAD^ | ||
| - | | ||
| - | Revenir en arrière sur un commit spécifique | ||
| + | Revenir en arrière sur un commit spécifique | ||
| git reset --hard 13e8d052383d96c1cdfef188ede3dd4fdffd53ad | git reset --hard 13e8d052383d96c1cdfef188ede3dd4fdffd53ad | ||
| - | | + | |
| ou 13e8d052383d96c1cdfef188ede3dd4fdffd53ad est le numéro du commit | ou 13e8d052383d96c1cdfef188ede3dd4fdffd53ad est le numéro du commit | ||
| doc: https:// | doc: https:// | ||
| + | ===== annuler le reset ===== | ||
| + | on vient de faire le reset //supra// et on se rend compte que c'est une grosse c...! | ||
| + | |||
| + | utiliser reflog pour trouver le bon commit: | ||
| + | |||
| + | <code bash> | ||
| + | radeff@radeff-lenovo: | ||
| + | eeb6cd2 (HEAD -> master, origin/ | ||
| + | c8fd577 HEAD@{1}: commit: minor | ||
| + | eeb6cd2 (HEAD -> master, origin/ | ||
| + | dd3b660 HEAD@{3}: clone: from REPOSITORY: | ||
| + | </ | ||
| + | |||
| + | ici, c'est donc le c8fd577 qu'on va restaurer avec cherry-pick | ||
| + | |||
| + | <code bash> | ||
| + | radeff@radeff-lenovo: | ||
| + | [master b95febf] minor | ||
| + | Date: Thu Dec 4 06:33:13 2025 +0100 | ||
| + | 13 files changed, 683 insertions(+), | ||
| + | | ||
| + | </ | ||
| + | |||
| + | ouf! petite sueur passée... | ||
| + | |||
| + | <note important> | ||
| + | ===== cherry-pick (cloner un commit d'une branche à une autre) ===== | ||
| + | git cherry-pick db6f662 | ||
| + | | ||
| + | https:// | ||
| ===== Chercher / search function ===== | ===== Chercher / search function ===== | ||
| git log --patch | git log --patch | ||
| Ligne 95: | Ligne 131: | ||
| si on veut chercher ds ttes les versions | si on veut chercher ds ttes les versions | ||
| git log -p grep ... | git log -p grep ... | ||
| - | + | ||
| doc https:// | doc https:// | ||
| ===== Branch: " | ===== Branch: " | ||
| Ligne 111: | Ligne 147: | ||
| git commit -am "My feature is ready" | git commit -am "My feature is ready" | ||
| - | Push your branch to GitLab: | + | Push your branch to Git: |
| git push origin $feature_name | git push origin $feature_name | ||
| - | voir https:// | + | doc [[gitlab]]: |
| ===== Cloner une branche spécifique ===== | ===== Cloner une branche spécifique ===== | ||
| - | git clone -b my-branch https:// | + | git clone -b my-branch https:// |
| exemple, cloner la branche stable de limesurvey et la mettre à jour | exemple, cloner la branche stable de limesurvey et la mettre à jour | ||
| - | git clone -b 2.06lts git@github.com: | + | git clone -b 2.06lts git@gitlab.com: |
| - | git pull git@github.com: | + | git pull git@gitlab.com: |
| ===== Renommer la branche master de votre dépôt Git en main ===== | ===== Renommer la branche master de votre dépôt Git en main ===== | ||
| Ligne 160: | Ligne 196: | ||
| https:// | https:// | ||
| - | ==== clés ssh ==== | ||
| - | Si vous avez un méchant message lors d'un pull ou d'un push genre: | ||
| - | < | ||
| - | Permission denied (publickey). | ||
| - | fatal: Could not read from remote repository. | ||
| - | |||
| - | Please make sure you have the correct access rights | ||
| - | and the repository exists. | ||
| - | </ | ||
| - | |||
| - | Déclarer les clés dans la section //Deploy Keys// pour le dépot: | ||
| - | |||
| - | https:// | ||
| - | |||
| - | Voir l' | ||
| === How to use "git clone" with a custom SSH key === | === How to use "git clone" with a custom SSH key === | ||
| Ligne 186: | Ligne 207: | ||
| </ | </ | ||
| + | ====== Git Cheat Sheets ====== | ||
| + | |||
| + | https:// | ||
| ====== Tutoriels ====== | ====== Tutoriels ====== | ||
| Ligne 203: | Ligne 227: | ||
| ====== git GUI ====== | ====== git GUI ====== | ||
| des clients graphiques pour git | des clients graphiques pour git | ||
| + | |||
| + | ===== Git Graph ===== | ||
| + | un plugin bien pratique pour [[info: | ||
| + | |||
| + | https:// | ||
| ===== Gitcraken / git GUI ===== | ===== Gitcraken / git GUI ===== | ||
| // | // | ||
| Ligne 211: | Ligne 240: | ||
| ===== qgit ===== | ===== qgit ===== | ||
| - | <note tip>qgit = un vrai logiciel linux: moche, mais efficace.</ | + | [[qgit]] version graphique |
| - | + | ||
| - | < | + | |
| - | sudo apt-get install qgit | + | |
| - | </ | + | |
| - | + | ||
| - | Installable sur un serveur, avec un petit coup de | + | |
| - | + | ||
| - | xhost+ | + | |
| - | ssh votre_serveur | + | |
| - | + | ||
| - | ou | + | |
| - | + | ||
| - | ssh -X votre_serveur | + | |
| - | cd votre_repertoire_git | + | |
| - | qgit | + | |
| - | + | ||
| - | Le résultat est pas aussi top que sur gitlab mais c'est quand même assez bon: | + | |
| - | + | ||
| - | {{: | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| ====== GitLab ====== | ====== GitLab ====== | ||
| - | Version web libre de git avec une vue [[http:// | + | Version web libre de git qui est, lui, dans la prison CroSoft. Je n'en reviens toujours pas du nombre de librisite qui ne sont pas passés de gitHub à gitLab mais c'est comme ça |
| - | https://gitlab.com/ | + | <note tip>[[gitlab]]</note> |
| - | c'est le plus simple si vous ne voulez pas installer tout le tintouin... | ||
| - | |||
| - | Mon espace gitlab: https:// | ||
| - | ===== Fork ===== | ||
| - | https:// | ||
| - | ===== Merge / Merging request ===== | ||
| - | https:// | ||
| - | ===== Groups ===== | ||
| - | https:// | ||
| - | |||
| - | https:// | ||
| - | ===== Todos / Issues ===== | ||
| - | Système de ticketing de gitlab | ||
| - | * [[https:// | ||
| - | Utiliser gitlab comme outil collaboratif de gestion de projet/ | ||
| - | * https:// | ||
| - | ===== Doc ===== | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * https:// | ||
| - | |||
| - | |||
| - | ===== Local install ===== | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| ====== Github ====== | ====== Github ====== | ||
| - | |||
| {{: | {{: | ||
| ===== Github -> gitlab ===== | ===== Github -> gitlab ===== | ||
| Github a été racheté par MS. C'est donc mal. On peut facilement migrer ses dépôts sur gitlab, qui est libre et opensource: [[https:// | Github a été racheté par MS. C'est donc mal. On peut facilement migrer ses dépôts sur gitlab, qui est libre et opensource: [[https:// | ||
| - | Si on veut faire manuellement: | + | Et si vous voulez qu'on vous voie toujours sur windaube, ben suffit de laisser votre repo ouvert et de pointer depuis sur vos repos ouverts. |
| - | + | ||
| - | exemple avec mes recettes de cuisine | + | |
| - | < | + | |
| - | git pull git@gitlab.com: | + | |
| - | #soit le répertoire créé recipesCakePHP | + | |
| - | mv ~/ | + | |
| - | mv recipesCakePHP/ | + | |
| - | cd ~/ | + | |
| - | git remote add gitlab git@gitlab.com: | + | |
| - | git push -f --tags gitlab refs/ | + | |
| - | puis comme d'hab avec git | + | |
| - | </ | + | |
| - | + | ||
| - | Et si vous voulez qu'on vous voie toujours sur windaube, ben suffit de laisser votre repo ouvert et de pointer depuis sur vos repos ouverts, ex: https:// | + | |
| ===== Flux RSS de github ===== | ===== Flux RSS de github ===== | ||
| GitHub provides some official RSS feeds officially: | GitHub provides some official RSS feeds officially: | ||
| Ligne 302: | Ligne 263: | ||
| Credits: https:// | Credits: https:// | ||
| - | ===== Tips ===== | ||
| - | ==== gitlab-api ==== | ||
| - | |||
| - | https:// | ||
| - | |||
| - | ==== Trouver les gros fichiers ==== | ||
| - | |||
| - | |||
| - | <code bash> | ||
| - | git rev-list --objects --all \ | ||
| - | | git cat-file --batch-check=' | ||
| - | | sed -n ' | ||
| - | | sort --numeric-sort --key=2 \ | ||
| - | | tail -n 10 \ | ||
| - | | cut -c 1-12,41- \ | ||
| - | | $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest | ||
| - | </ | ||
| - | source: https:// | ||
| ====== Voir aussi ====== | ====== Voir aussi ====== | ||
| * [[https:// | * [[https:// | ||
| * [[: | * [[: | ||
| - | {{tag> | + | {{tag> |