Files
mash-lab/MOper/git.man
2025-09-03 20:46:27 +00:00

63 lines
1.7 KiB
Groff
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
1⃣ Cloner le dépôt Git
Si ton dépôt est vide ou existant :
# Cloner un dépôt distant sur ton serveur
git clone http://192.168.42.10:7630/morgane/mash-lab.git
cd mash-lab
💡 Si ton mot de passe contient des caractères spéciaux (&, @, etc.), encode-les ou utilise un credential helper :
git config --global credential.helper store
2⃣ Configurer ton identité Git (une seule fois par serveur)
git config --global user.name "Morgane"
git config --global user.email "enagore@gmail.com"
3⃣ Créer/modifier des fichiers ou dossiers
Ajouter un dossier
mkdir mon-dossier
Ajouter un fichier
touch mon-fichier.txt
nano mon-fichier.txt # ou vim/vi pour éditer
Supprimer un fichier ou dossier
rm mon-fichier.txt
rm -r mon-dossier # pour un dossier et son contenu
4⃣ Suivre les changements dans Git
git status # voir les fichiers modifiés/non suivis
git add fichier-ou-dossier # ajouter un fichier ou dossier au commit
git add . # ajouter tous les changements
5⃣ Créer un commit
git commit -m "Message décrivant les changements"
💡 Chaque commit doit résumer clairement ce qui a été fait.
6⃣ Envoyer les changements sur le dépôt distant (push)
Sassurer dêtre sur la bonne branche (souvent main) :
git branch # liste les branches
git checkout main # changer de branche si nécessaire
Envoyer les commits :
git push origin main
💡 Si cest le premier push sur un dépôt vide, assure-toi davoir créé la branche main :
git checkout -b main
git push -u origin main
7⃣ Récupérer les modifications du dépôt distant (pull)
git pull origin main
Avec ces commandes, tu peux cloner, modifier, ajouter, supprimer, commit et push tous tes fichiers et dossiers sur ton serveur Git.