Explore essential concepts for optimizing Git performance and managing large repositories efficiently. This quiz covers advanced Git commands, scaling techniques, and best practices for handling big codebases and ensuring smooth version control workflows.
When a repository grows to contain thousands of large binary files, which native Git feature is designed to efficiently store and manage such files without bloating the main repository?
Explanation: Git LFS (Large File Storage) is specifically designed to handle large binary files by storing pointers in the repository while keeping the files themselves in a separate storage system, thus preventing repository bloat. Git Submodules are used for embedding one repository inside another, not for handling large files. Git Bisect helps to find the commit that introduced a bug, but it does not influence file storage. Git Merge is related to combining branches and has no impact on handling large files efficiently.
Which Git command enhancement can significantly speed up the cloning process of a very large repository when the complete history is not required?
Explanation: Using 'git clone --depth' performs a shallow clone by fetching only the most recent commit(s), which greatly speeds up cloning by reducing the amount of history downloaded. 'git push --mirror' is meant for mirroring a repository, not cloning it. 'git reset --soft' moves HEAD without modifying the working directory or index but does not affect cloning. 'git fetch --all' retrieves all branches but does not limit history depth and is not used for the initial clone process.
If Git operations like switching branches or committing become noticeably slower in a large repository, which internal Git file is most likely to become particularly large and negatively impact performance?
Explanation: The .git/index file records the current state of the working directory and tracks all files, growing proportionally with the number of files. If this file becomes large, performance for certain operations can degrade. .gitignore manages ignored files and doesn't impact performance directly. .gitattributes specifies attributes and settings, but does not increase performance overhead related to file tracking. .gitmodules is only relevant when submodules are used, not affecting general performance.
A team decides to break a huge monolithic repository into smaller, more manageable ones while preserving history for each subdirectory. Which tool or command is most suitable for this task?
Explanation: The 'git filter-repo' tool is designed to rewrite repository history, making it suitable for splitting a repository by preserving part of the history relevant to subdirectories. 'git commit -am' simply commits changes and does not affect repository structure. 'git merge --squash' combines changes without keeping detailed commit history and isn't for splitting repositories. 'git stash pop' applies stashed changes and is unrelated to repository splitting or history preservation.
Which Git configuration reduces the time taken by 'git status' and similar commands in very large repositories by avoiding unnecessary file system scans?
Explanation: 'core.untrackedCache' caches information about untracked files, which can speed up status checks in large repositories by reducing repeated scans. 'merge.conflictStyle' adjusts how conflicts are displayed but does not impact status speed. 'push.default' configures the behavior of push operations, not local status commands. 'receive.denyCurrentBranch' sets rules for updates received by the current branch and has no effect on working directory performance.