lab 42 Adding a Tracking Branch
Goals
- Learn how to add a local branch that tracks a remote branch.
The branches starting with remotes/origin are branches from the original repo. Notice that you don’t have a branch called greet anymore, but it knows that the original repo had a greet branch.
Add a local branch that tracks a remote branch.
Execute:
git branch --track greet origin/greet git branch -a git hist --max-count=2
Output:
$ git branch --track greet origin/greet branch 'greet' set up to track 'origin/greet'. $ git branch -a greet * main remotes/origin/HEAD -> origin/main remotes/origin/greet remotes/origin/main $ git hist --max-count=2 * e72f27a 2023-08-21 | Changed README in original repo (HEAD -> main, origin/main, origin/HEAD) [Théophile Chevalier] * d81bcbf 2023-08-21 | Hello uses Greeter (origin/greet, greet) [Théophile Chevalier]
We can now see the greet branch in the branch list and in the log.