Challenge - 5 Problems
Branch Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediateWhat is the output of 'git branch' after creating two branches?
You have a Git repository with the default branch named
Then you run
main. You run these commands:git branch feature1git branch feature2Then you run
git branch. What is the output?Git
git branch feature1 git branch feature2 git branch
Attempts:
2 left
💡 Hint
The asterisk (*) marks the current branch.
✗ Incorrect
The
git branch command lists all branches. The current branch is marked with an asterisk (*). Since you did not switch branches, main is current.💻 Command Output
intermediateWhat does 'git branch -r' show?
You cloned a repository and run
git branch -r. What does this command list?Git
git branch -rAttempts:
2 left
💡 Hint
Remote branches are branches on the server you cloned from.
✗ Incorrect
The
-r option shows remote-tracking branches, which represent branches on the remote repository.❓ Configuration
advancedHow to list branches sorted by last commit date?
You want to list all local branches sorted by the date of their last commit, most recent first. Which command achieves this?
Attempts:
2 left
💡 Hint
The
--sort option can sort by commit dates; the minus sign reverses order.✗ Incorrect
The
--sort=-committerdate option sorts branches by the committer date descending (most recent first).❓ Troubleshoot
advancedWhy does 'git branch' show no branches after cloning?
You cloned a remote repository with
git clone https://example.com/repo.git. Then you run git branch and see no output. Why?Attempts:
2 left
💡 Hint
Bare repositories do not have working copies or local branches.
✗ Incorrect
Cloning with the
--bare option creates a repository without a working directory and no local branches, so git branch shows nothing.✅ Best Practice
expertWhich command safely lists all branches including remote and local with verbose info?
You want to see all branches, local and remote, with last commit info, in a single command. Which is the best command?
Attempts:
2 left
💡 Hint
The
-a option shows all branches, -v adds commit info.✗ Incorrect
The command
git branch -a -v lists all branches (local and remote) with the last commit info.