Comprendre les fondamentaux de Git pour gérer efficacement le code source et travailler en équipe.
Objectif : Comprendre les fondamentaux de Git pour gérer efficacement le code source et travailler en équipe.
git init
git clone URL_DU_DEPOT
git add chemin_du_fichier
git status
git commit -m "Message du commit"
git branch
git branch nom_branche
git checkout nom_branche
git merge nom_branche
git add fichier_modifié git commit
git fetch
git pull
git push
Cloner le dépÎt :
git clone https://github.com/TechNovaCorp/TaskManagerPro.git
Vérifier les branches existantes :
cd TaskManagerPro
git branch -a
Créer une branche de développement :
develop :
git checkout -b develop
Soumettre des modifications :
git add README.md git commit -m "Ajout d'un commentaire au README"
develop vers le dépÎt distant :
git push origin develop
Un workflow Git populaire pour structurer les branches :
main : contient le code en production.develop : contient le code en cours de développement.feature/* : pour le développement de nouvelles fonctionnalités.hotfix/* : pour corriger des bugs critiques en production.Approche minimaliste :
main) et poussent des modifications en continu.Configurer les branches principales :
main et develop si elles nâexistent pas :
git checkout -b main git push origin main git checkout -b develop git push origin develop
Développer une nouvelle fonctionnalité :
feature/ma_nouvelle_fonctionnalite Ă partir de develop :
git checkout -b feature/ma_nouvelle_fonctionnalite develop
git add fichier git commit -m "Ajout de ma nouvelle fonctionnalité"
feature dans develop :
git checkout develop git merge feature/ma_nouvelle_fonctionnalite
git push origin develop
Corriger un bug critique :
hotfix/correction_bug Ă partir de main :
git checkout -b hotfix/correction_bug main
git add fichier git commit -m "Correction du bug critique"
hotfix dans main et develop :
git checkout main git merge hotfix/correction_bug git push origin main git checkout develop git merge hotfix/correction_bug git push origin develop