Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git Revision Selection and Ancestry Queries

Create a disposable repository with a base commit, two commits on a topic branch, two commits on `main`, and a non-fast-forward merge. Record the merge's first and second parent IDs. Use `MERGE^`, `MERGE^2`, `MERGE~2`, `MERGE^@`, `MERGE^!`, and `MERGE^-2` and explain each result. Then create two divergent branch tips and prove `A..B`, `^A B`, and `A...B` produce the documented commit sets. Finally, build a commit containing a deliberately chosen message and file, resolve it with `:/message` and `R:path`, and compare `git log A...B` with `git diff A...B` so the history-selection and endpoint-comparison semantics are explicit.

Advanced ~6 min read

Challenge 1

Complete the Git command to inspect commit history.

bash Your answer
git  A...B

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to compare repository states.

bash Your answer
git  A...B

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to resolve or verify a revision.

bash Your answer
git  MERGE^

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to resolve or verify a revision.

bash Your answer
git  MERGE^2

Press Ctrl⌘Enter to check your answer