Lorsque que Git est installé sur votre machine (Linux, Windows ou Mac), on peut commencer à jouer avec. Pour rappel l’installation de Git sous Windows se trouve ici.
Première chose à faire sous Windows, trouver (ou créer) son répertoire de travail et faire un clic droit sur le dossier pour démarrer Git en Bash.
Premières commandes sous Git
[pastacode lang=”bash” manual=”%23%C2%A0Initialisation%20d’un%20projet%20git%0Agit%20init%0A%0A%23%C2%A0V%C3%A9rifier%20l’%C3%A9tat%20du%20projet%20(commit%20en%20attente)%0Agit%20status%0A%0A%23%C2%A0Ajouter%20tous%20les%20fichiers%20modifi%C3%A9s%0Agit%20add%20.%0A%0A%23%C2%A0R%C3%A9aliser%20un%20commit%0Agit%20commit%20-m%20%22Message%20d%C3%A9crivant%20le%20commit%22%0A%0A%23%C2%A0Modification%20du%20message%20du%20dernier%20commit%0Agit%20commit%20–amend%20-m%20%22nouveau%20message%22%0A%0A%23Voir%20le%20log%20condens%C3%A9%20d’un%20projet%0Agit%20log%20–pretty%3Doneline%0A%0A%0A” message=”” highlight=”” provider=”manual”/]
Gérer les dépôts
[pastacode lang=”bash” manual=”%23Cr%C3%A9er%C2%A0un%20projet%20vide%20sur%20le%20d%C3%A9p%C3%B4t%20distant%0Amkdir%20konectik.git%0Acd%20konectik.git%0Agit%20–bare%20init%0A%0A%23Cr%C3%A9er%20le%C2%A0lien%20de%20mise%20%C3%A0%20jour%20avec%20le%20d%C3%A9p%C3%B4t%20distant%0Agit%20remote%20add%20origin%20git%40192.x.x.x%3A%2Fmnt%2FProjets_Git%2Fkonectik.git%0A%0A%23Pousser%20ses%C2%A0mises%20%C3%A0%20jour%20sur%C2%A0le%20d%C3%A9p%C3%B4t%20distant%0Agit%20push%20origin%20master%0A%0A%23R%C3%A9cup%C3%A9rer%20les%20modifications%20du%20d%C3%A9p%C3%B4t%20distant%0Agit%20pull%20origin%20master%0A%0A%23Conna%C3%AEtre%20le%20lien%20distant%20du%20d%C3%A9p%C3%B4t%0Agit%20config%20–get%20remote.origin.url%0A%0A%23Changer%20le%20%20lien%20distant%20%20du%20d%C3%A9p%C3%B4t%0Agit%20remote%20set-url%20origin%20git%40192.x.x.x%3A%2Fmnt%2FProjets_Git%2Fkonectik.git%0A%0A%23Cloner%20le%20du%20d%C3%A9p%C3%B4t%20distant%C2%A0en%20local%0Agit%20clone%20git%40192.x.x.x%3A%2Fmnt%2FProjets_Git%2Fkonectik.git” message=”” highlight=”” provider=”manual”/]
Gérer les branches
[pastacode lang=”bash” manual=”%23%C2%A0Cr%C3%A9ation%20d’une%20branche%0Agit%20checkout%20-b%20nom-de-la-branche%0A%0A%23%C2%A0Changer%20de%20branche%C2%A0de%20travail%0A%23%20%C2%A0%20–%C2%A0master%20%3A%20pour%20la%20branche%20principale%0Agit%20checkout%20master%0A%0A%23%20Fusionner%20les%20modifications%20de%20la%20branche%20%C3%A0%20la%20branche%20principale%0Agit%20merge%20nom-de-la-branche%0A%0A%23Effacer%20une%20branche%0Agit%20branch%20-d%20nom-de-la-branche%0A” message=”” highlight=”” provider=”manual”/]
Gérer les étiquettes
[pastacode lang=”bash” manual=”%23Cr%C3%A9er%20une%20%C3%A9tiquette%20sur%20le%20commit%20en%20cours%0Agit%C2%A0tag%20-a%20v1.0%C2%A0-m%20%22Version%201.0%22%0A%0A%23Cr%C3%A9er%20une%20%C3%A9tiquette%20sur%20un%20commit%20d%C3%A9fini%C2%A0%0A%23le%20dernier%20param%C3%A8tre%20est%20le%20checksum%20du%20commit%20d%C3%A9sir%C3%A9%20%0A%23(la%20clef%C2%A0peut%20%C3%AAtre%20partielle)%0Agit%20tag%20-a%20v0.1%20-m%20%22Version%20initiale%20Git%200.1%22%203d374dd5b1045f02a33a7662%0A%0A%23Modifier%20une%20%C3%A9tiquette%20existante%0Agit%20tag%20-f%20v0.1%20-m%20%22Version%20initiale%20Git%200.1%C2%A0-%20modifi%C3%A9e%22%203d374dd5b1045f02a33a766%0A%0A%23Effacer%20une%20%C3%A9tiquette%20existante%20%0Agit%20tag%20-d%20v0.1%20%0A%0A%23Visualiser%20toutes%20les%20%C3%A9tiquettes%0Agit%20show-ref%20–tags%0A%0A%23Pousser%20toutes%20les%20%C3%A9tiquettes%0Agit%20push%20origin%20–tags” message=”” highlight=”” provider=”manual”/]