Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git Branch Management: List, Create, Rename, Copy, Move, and Delete Branches

Build a disposable repository with at least three commits on main. Create a topic branch without switching, record both tips, then advance the topic branch using a real switch workflow. Create a second branch at an explicit start point, inspect branches with `-v`, rename one branch, copy another, and prove the resulting names resolve to the expected commit IDs. Create an unmerged branch and demonstrate that normal deletion refuses it; then, only in the disposable repository, demonstrate the forced deletion form. Finally, use `git branch -f` on a non-current branch and prove that only that branch ref moved. Capture command output and object IDs so every mutation is explained as a reference-state change. Success requires state evidence, not merely successful exit codes: record the branch list before and after each lifecycle operation, verify current-branch identity, record resolved commit IDs for every affected branch, and explain why rename, copy, delete, and force-move affect refs rather than creating alternative commit objects. Use disposable repositories for destructive operations.

Intermediate ~6 min read

Challenge 1

Complete the Git command to inspect or update branch refs.

bash Your answer
git  -f

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to inspect or update branch refs.

bash Your answer
git  --list

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to inspect or update branch refs.

bash Your answer
git  --show-current

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to inspect or update branch refs.

bash Your answer
git  -v

Press Ctrl⌘Enter to check your answer