29 quizzes
Create a new linked working directory for an existing branch in the same repository
git worktree /path/to/main-worktree mainClick an option to fill the blank:
Add an external repository as a dependency nested under the current project
git submodule https://example.com/lib.git libs/libClick an option to fill the blank:
Rewrite history to remove a tracked file from all commits using the legacy history-rewrite tool
git filter-branch --index-filter "git rm --cached --ignore-unmatch secret.txt" ---empty -- --allClick an option to fill the blank:
Remove a committed configuration file from all history using the modern history-rewrite tool
git filter-repo --invert-paths --path Click an option to fill the blank:
Prevent commits that contain staged files ending with .log using a local validation script
chmod +x .git/hooks/pre-commit && echo '#!/bin/shif git diff --cached --name-only | grep "\.log$" >/dev/null; then echo "Block"; exit 1; fi' > .git/hooks/Click an option to fill the blank:
What is a key benefit of using git worktree instead of cloning the same repository multiple times?
In a project using Git submodules, what does the parent repository store for each submodule?
Compared to submodules, which description best fits Git subtree?
Why is git filter-repo generally recommended over git filter-branch for history rewriting?
Which action is a typical use of a server-side pre-receive hook?
Order the steps to create a new worktree for a release branch and then remove it when done
Drag and drop to reorder, or use the arrows.
Order the steps to add a submodule and ensure teammates can use it after cloning the parent repo
Drag and drop to reorder, or use the arrows.
Order the steps to bring new changes from an external repository into an existing subtree directory
Drag and drop to reorder, or use the arrows.
Order the steps to remove a submodule cleanly from a project
Drag and drop to reorder, or use the arrows.
You are inside a linked worktree directory checked out on branch hotfix-1. What will this command print?
1git branch --show-currentIn a repository that has one submodule at path vendor/lib, what will this command output?
1git config -f .gitmodules --get submodule.vendor/lib.pathYou created a custom merge driver named html-merge in .gitattributes. What will this command print?
1git config merge.html-merge.nameFind the incorrect command in this workflow that tries to initialize and update submodules after cloning
Click on the line(s) that contain the bug.
git clone https://example.com/project.gitcd projectgit submodule add --init --recursivegit submodule update --init --recursiveIdentify the incorrect command in this attempt to remove a submodule
Click on the line(s) that contain the bug.
git rm path/to/modulerm -rf path/to/modulegit config --remove-section submodule.path/to/modulegit commit -m "Remove module submodule"Spot the mistake in this attempt to use git filter-repo to drop a directory from history
Click on the line(s) that contain the bug.
git clone --mirror https://example.com/repo.git repo-mirrorcd repo-mirrorgit filter-repo --path src/old/ --invertgit push --forceMatch advanced Git operations to their descriptions
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Match hook types with typical use cases
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Match Git attribute patterns with their effects
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Complete the commands to rewrite history and then push the updated history to the main remote
git filter-repo --invert-paths --path git push --forceClick an option to fill blank 1:
Fill in the commands to add and then update a subtree from a remote repository
git subtree add --prefix= main --squashgit subtree pull --prefix= main --squashClick an option to fill blank 1:
Complete the commands to configure Git attributes for text and binary files
echo "*.txt " >> .gitattributesecho "*.png " >> .gitattributesClick an option to fill blank 1:
Select the line that shows a worktree checked out on the release-1.0 branch
Click on the line to select.
/path/to/repo 1234567 [main]/path/to/repo-release 89abcde [release-1.0]/path/to/repo-hotfix fedcba9 [hotfix-2]Click the line that shows the parent repo tracking the submodule commit
Click on the line to select.
-2b3c4d5 vendor/lib (heads/main) 1234abc submodule-path (submodule) 98def00 another/path (untracked)Select the line that configures a custom merge driver name used by .gitattributes
Click on the line to select.
merge.html-merge.name=Custom HTML merge drivermerge.html-merge.driver=html-merge-driver %O %A %Bcore.autocrlf=false