Adloun

Git : l'historique d'un projet (école d'ingénieur) · Chapitre 6 · Exercice de TD

Ce que contient un clone

Les dépôts distants · niveau 1 (application)

Énoncé

Le dépôt nu /srv/essai.git a deux branches, main et agenda. On le clone :


$ git clone -q /srv/essai.git b
$ cd b
$ git branch
* main

La branche agenda a-t-elle été récupérée ? Comment le vérifier, et comment y travailler ?

Corrigé

Oui : le clone a récupéré toutes les branches, mais seulement en branches de suivi ; seule la branche principale a une branche locale. git branch -a le montre, et git switch agenda crée la branche locale à partir d'origin/agenda :


$ git branch -a
* main
  remotes/origin/HEAD -> origin/main
  remotes/origin/agenda
  remotes/origin/main
$ git switch agenda
branch 'agenda' set up to track 'origin/agenda'.
Switched to a new branch 'agenda'
$ git branch
* agenda
  main

Exercices semblables

Le cours du chapitre · Tous les exercices du chapitre