Recall & Review
beginner
What command lists all local branches in a Git repository?
The command
git branch lists all local branches in your Git repository.Click to reveal answer
beginner
How do you list all remote branches in Git?
Use
git branch -r to list all remote branches.Click to reveal answer
beginner
What command shows both local and remote branches in Git?
Use
git branch -a to see all branches, local and remote.Click to reveal answer
beginner
What does the asterisk (*) mean when you run
git branch?The asterisk (*) marks the branch you are currently working on (the active branch).
Click to reveal answer
intermediate
How can you list branches sorted by the last commit date?
Use
git branch --sort=-committerdate to list branches sorted by the most recent commit first.Click to reveal answer
Which command lists only local branches in Git?
✗ Incorrect
git branch lists local branches only. -r is for remote branches, and -a or --all shows both local and remote.
What does
git branch -r show?✗ Incorrect
git branch -r lists only remote branches.
How do you see all branches, local and remote, in one command?
✗ Incorrect
git branch -a shows all branches, both local and remote.
In the output of
git branch, what does the * symbol indicate?✗ Incorrect
The asterisk (*) marks the branch you are currently on.
Which command sorts branches by the most recent commit date?
✗ Incorrect
git branch --sort=-committerdate sorts branches with the newest commit first.
Explain how to list local, remote, and all branches in Git.
Think about the different flags used with git branch.
You got /3 concepts.
Describe what the asterisk (*) means in the output of git branch.
It marks your current position in the project.
You got /2 concepts.