Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git Merge vs Rebase vs Cherry-Pick: Comparing History Transformations

Build three small disposable repositories. In the first, create divergent branches and merge them; record both merge parents. In the second, create a topic sequence and a new main base, then rebase the topic; record old and new commit IDs and verify ancestry. In the third, create two source commits, switch to another destination history, and cherry-pick only the first; prove that the second source change was not selected.

Intermediate ~6 min read

Challenge 1

Complete the Git command to integrate the selected branch.

bash Your answer
git  topic

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to replay commits onto a new base.

bash Your answer
git  main

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to use the `git cherry-pick` operation.

bash Your answer
git  <selected-commit>

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to inspect commit history.

bash Your answer
git  --graph --oneline --decorate --all

Press Ctrl⌘Enter to check your answer