Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git Upstream and Tracking Configuration: Connecting Local Branches to Remote Branches

Create a disposable bare remote and clone it. Verify that the cloned main branch has an upstream. Create a local topic branch from origin/main with --no-track and verify that topic@{upstream} fails. Then set its upstream explicitly with git branch --set-upstream-to=origin/main topic and verify the relationship with git branch -vv and topic@{upstream}. Change the tracking target to another remote-tracking branch without moving topic, then remove the upstream with --unset-upstream. Finally, create another branch with --track=direct and observe that the branch tip and its upstream relationship are separate pieces of state.

Intermediate ~6 min read

Challenge 1

Complete the Git command to inspect or update branch refs.

bash Your answer
git  -vv

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to inspect or update branch refs.

bash Your answer
git  --set-upstream-to=origin/main main

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to inspect or update branch refs.

bash Your answer
git  --unset-upstream main

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to inspect or update branch refs.

bash Your answer
git  --track=direct topic origin/main

Press Ctrl⌘Enter to check your answer