What is the primary role of Git in build automation?
- Facilitates collaboration among developers
- Manages and tracks changes in source code
- Automates the process of compiling code
- Monitors server performance
Git plays a crucial role in build automation by managing and tracking changes in the source code. It helps developers collaborate seamlessly while automating the compilation process.
Which Git command is used to download a repository from a remote server?
- git clone
- git fetch
- git pull
- git push
The correct command to download a repository from a remote server is git clone. This command not only downloads the repository but also sets up tracking so that you can pull changes later.
Which branching strategy in Git involves creating new branches for each feature?
- Feature Branching
- GitFlow
- Trunk-Based Development
- Forking Workflow
Feature Branching is a strategy where a new branch is created for each feature or bug fix, allowing for isolated development and easy integration. It helps in parallelizing work and maintaining a clean project history.
The ________ branch in Gitflow is used for integrating features before a release.
- Feature
- Release
- Hotfix
- Develop
The "Develop" branch in Gitflow is used for integrating features before a release. It serves as a branch where all completed features are merged before creating a new release.
What is the main purpose of forking a repository in Git?
- Contribute to someone else's project
- Create a backup of the repository
- Merge two branches
- Undo the last commit
Forking a repository in Git is primarily done to contribute to someone else's project. It allows you to create a personal copy of a repository on which you can make changes without affecting the original project. You can later submit pull requests to propose changes to the original repository.
In a code review, checking for _______ and _______ is essential to maintain code quality.
- syntax errors, performance issues, formatting, logic errors
- documentation, security vulnerabilities, formatting, functionality
- syntax errors, performance issues, documentation, security vulnerabilities
- formatting, code complexity, security vulnerabilities, logic errors
In a code review, it's crucial to check for documentation and security vulnerabilities to ensure not only the correctness of the code but also its readability and safety.
The command git __________ is useful for reducing the size of a repository by removing unnecessary data.
- gc
- prune
- cleanup
- compress
The 'git gc' command (garbage collection) is used to optimize and clean up the local repository by removing unnecessary data, reducing its size.
How can advanced rebasing techniques be used to resolve complex merge conflicts in Git?
- git merge-base
- git rebase -i
- git cherry-pick
- git reset
Advanced rebasing can be performed using git rebase -i, allowing you to interactively choose how to apply and modify commits. This helps in resolving complex merge conflicts by providing a more granular approach to handle changes.
What is the basic benefit of using Git for database version control?
- Enables tracking of changes to database schema and data
- Enhances database performance
- Provides real-time database monitoring
- Automates database backups
Git benefits database version control by enabling the tracking of changes to database schema and data. This ensures version history and facilitates collaboration in database development.
A tag in Git is like a bookmark to a specific ________ in the repository's history.
- branch
- commit
- file
- pull request
The correct option is b) commit. A tag in Git is a reference to a specific commit in the repository's history. It serves as a permanent marker for a specific point in time, often used to mark release points.
In large projects, Git's __________ feature is crucial for managing different development streams.
- Rebase
- Merge
- Branch
- Stash
Git's branching feature is crucial in large projects as it allows developers to work on different development streams concurrently. Each branch can represent a specific feature or bug fix, making it easier to manage and merge changes later.
How do branch protection rules contribute to repository security?
- Prevent force pushes to protected branches
- Restrict branch deletion
- Control who can merge to certain branches
- All of the above
Branch protection rules enhance repository security by preventing force pushes, restricting branch deletion, and controlling who can merge to specific branches. However, the options provided do not include the correct answer.