Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git Mailbox Patch Series: Apply with git am

Create a disposable source repository with a base commit followed by two ordinary commits. Generate a mailbox series with `git format-patch -o patches BASE..HEAD`. In a separate target repository at the same base, run `git am patches/*.patch` and prove that two commits were created. Compare the resulting author and committer identities and commit messages with the source commits. Then repeat using `git am < series.mbox`. Create a deliberately conflicting target commit and apply a patch that cannot apply cleanly. Use `git am --show-current-patch=diff`, resolve the conflict, stage the resolution, and finish with `git am --continue`. In a second run, use `git am --skip` to omit one patch from a multi-patch series. In a final run, start an `am` operation and use `git am --abort`; prove that the branch and working tree return to their pre-operation state. Explain why `git apply` is not the correct command for reconstructing commits from the mailbox.

Advanced ~6 min read

Challenge 1

Complete the Git command to apply the mailbox series as commits.

bash Your answer
git  patches/*.patch

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to apply the mailbox series as commits.

bash Your answer
git  < series.mbox

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to apply the mailbox series as commits.

bash Your answer
git  --show-current-patch=diff

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to apply the mailbox series as commits.

bash Your answer
git  --continue

Press Ctrl⌘Enter to check your answer