A clean Git history is often maintained by using _______ to combine commits before merging.
- git squash
- git merge --squash
- git combine
- git rebase -i
The correct option is git rebase -i. Interactive rebase (-i) allows you to combine, edit, or reorder commits interactively. Squashing commits during interactive rebase helps create a cleaner and more organized Git history before merging into the main branch.
When migrating to Git, it's crucial to convert the old VCS __________ into Git commits.
- History
- Branches
- Tags
- Commits
During the migration process to Git, converting the old version control system's commits into Git commits preserves the project's history, allowing for a seamless transition and maintaining version information.
In secure Git practices, a _______ branch strategy involves using separate branches for development and production.
- feature
- release
- topic
- gitflow
The correct option is topic. In a secure Git branching strategy, using separate branches for development and production is commonly known as the "topic branch" strategy. Each feature or bug fix is developed in a topic branch before being merged into the main branches. This helps maintain a clean and stable main branch for production releases.
How can Git be configured to handle large binary files often found in database backups?
- Enabling Git LFS
- Using Git submodules
- Configuring Git to use shallow clones
- Ignoring binary files in .gitignore
Git Large File Storage (LFS) is designed to handle large binary files, making it the appropriate choice for managing files often found in database backups. Enabling Git LFS ensures that large files are stored outside the Git repository, preventing repository bloat.
How does Git's 'fast-forward' merge differ from a 'three-way' merge?
- Fast-forward merge applies when the branch being merged has no new commits since the base, while a three-way merge handles cases where both branches have new commits.
- Fast-forward merge is a Git command used to combine branches with a linear history, while a three-way merge is used for non-linear histories, creating a new commit that ties the histories together.
- Fast-forward merge is a synonym for three-way merge in Git, both terms refer to the same process.
- Fast-forward merge only considers changes in the working directory, whereas a three-way merge considers changes in both branches and the common ancestor.
In Git, a fast-forward merge occurs when the branch being merged has no new commits since the base, while a three-way merge is used for branches with divergent commits.
What is a tag in Git?
- A reference to a specific commit
- A branch in Git
- A merge conflict
- A file in the working directory
In Git, a tag is a reference to a specific commit. It is often used to mark a specific point in history, such as a release or a stable version. Tags are immutable and don't change with new commits.
How do you merge changes from a Subtree back into the main repository?
- Use 'git merge' with the Subtree's remote repository
- Use 'git pull' in the Subtree repository
- Use 'git subtree merge' command
- Manually copy and paste changes from Subtree
Merging changes from a Git Subtree involves using the 'git subtree merge' command. This command combines changes from the subtree repository into the main repository, maintaining history and avoiding unnecessary conflicts. Understanding subtree merging is vital for managing code modularization.
What is the purpose of the 'HEAD' in a Git repository?
- Points to the latest commit
- Marks the branch currently in use
- Identifies the working directory state
- Represents the commit before the merge
The 'HEAD' in Git points to the latest commit in the branch, indicating the current working state. It helps identify which commit will be used as the starting point for the next commit.
A team wants to ensure that no commit messages are pushed without a specific ticket number format. Which Git Hook should they configure?
- pre-receive
- post-commit
- update
- pre-commit
In Git, the pre-commit hook is executed just before a commit is made, making it suitable for enforcing commit message formats. By configuring the pre-commit hook, the team can validate commit messages against the required ticket number format.
For database version control, the practice of _______ with Git ensures that database changes are reviewed before being deployed.
- branching
- rebasing
- forking
- tagging
In the context of database version control, the practice of rebasing with Git allows developers to incorporate changes from one branch into another. This ensures that database changes are reviewed and integrated smoothly before deployment. Rebasing helps maintain a clean and linear history, making it easier to track changes and resolve conflicts during the review process.