command-line:git:branches
Ceci est une ancienne révision du document !
Table des matières
Branches
On peut travailler sur plusieurs branches en parallèle. Par défaut l'unique branche est “master”.
Gestion basique des branches
git branch #list existing branches and point the current one git branch A #create a new branch git checkout A #work on branch A (replaces files in working dir) git merge B #merge B modifications into the current branch git branch -d B #delete branch B
Conflits
Si, lors d'une fusion, un conflit apparait, les fichiers concernés comporteront un ou plusieurs passages de la forme :
<<<<<<< HEAD:fichier.txt Version 1 ======= Version 2 >>>>>>> prob53:fichier.txt
En ce cas, la version du haut est celle de HEAD, donc de la branche actuellement extraite, et celle du bas vient de la branche qu'on tente de fusionner dans la branche courante.
Modifier le fichier pour faire la fusion “manuellement”, puis lancer git add pour résoudre le conflit.
Autre solution : git mergetool
En vrac
Diverses commandes utiles
#list existing branches with last action in each git branch -v #list branches that were already merge with the current branch git branch --merged #list branches that have unmerged work compared to current branch git branch --no-merged #create local branch from existing remote branch git checkout -b C remoteName/C #delete branch on remote repository git push remoteName :C #same syntax as pushing the local branch to the remote git push remoteName C:C
command-line/git/branches.1364981330.txt.gz · Dernière modification : le 03/04/2013 à 09:28 de Yosko