Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git Blame: Trace Line-Level Provenance

Create a disposable repository with at least four commits affecting one file, including a whitespace-only change and a substantial copy of lines into another file. Run ordinary blame and a focused `-L` blame. Demonstrate `-M`/`-C` for moved or copied lines. Use `--ignore-rev` and `--ignore-revs-file` for the mechanical revision. Run `--porcelain` and `--line-porcelain`, then demonstrate `--reverse` across a range in which a line is later removed. Finally compare ordinary blame with `--first-parent` on a repository containing a merge. Record what investigative question each invocation answers and verify that none of the commands changes repository history.

Advanced ~6 min read

Challenge 1

Complete the Git command to attribute lines in the target file.

bash Your answer
git 

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to attribute lines in the target file.

bash Your answer
git  src/example.txt

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to attribute lines in the target file.

bash Your answer
git  -L 20,40 src/example.txt

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to attribute lines in the target file.

bash Your answer
git  -L '/^function example\(\)/,/^}$/' src/example.txt

Press Ctrl⌘Enter to check your answer