A developer needs to apply a hotfix from the master branch to a release branch without merging other changes. What Git feature should they use?

  • Cherry-pick
  • Merge
  • Rebase
  • Clone
The correct option is Cherry-pick. This Git feature allows a developer to select a specific commit and apply it to another branch, making it ideal for applying isolated changes such as hotfixes. Unlike merge or rebase, cherry-pick targets a single commit.

A _______ branch is typically used for preparing, polishing, and finalizing a release.

  • release
  • feature
  • master
  • hotfix
A release branch is created to prepare, polish, and finalize a release. It is used to stabilize the code and ensure that it is ready for production before merging it into 'master.'

In an enterprise setting, a Git repository's performance is degrading over time due to accumulated obsolete data. What Git maintenance practice would be most effective?

  • Git garbage collection
  • Git cloning
  • Git rebase
  • Git cherry-pick
The most effective Git maintenance practice in this scenario is running Git garbage collection. It helps clean up unnecessary data, optimize the repository, and improve overall performance.

How does Git support Agile development principles like collaboration and flexibility?

  • Through its branching and merging capabilities
  • By enforcing a strict development process
  • By limiting the number of developers in a project
  • By providing a centralized code repository
Agile Development with Git

Which Git Hook is triggered before a commit is finalized?

  • pre-commit
  • post-commit
  • pre-receive
  • post-receive
The pre-commit hook is triggered before a commit is finalized. It allows you to inspect the changes that are about to be committed and optionally abort the commit. This hook is useful for tasks like code formatting or running pre-commit tests.

In the Gitflow workflow, the ________ branch contains the official release history.

  • Master
  • Develop
  • Release
  • Hotfix
In Gitflow, the "Release" branch contains the official release history, and it is where code freezes in preparation for a new release. This branch helps manage versioning effectively.

When cherry-picking a commit, Git creates a new commit with a different ________ even if the content is the same.

  • Hash
  • Branch
  • Message
  • Timestamp
When cherry-picking a commit in Git, it generates a new commit with a different hash to maintain uniqueness, even if the content is identical. The hash is a cryptographic checksum of the commit, and altering the commit creates a new hash.

The ________ command in Git is commonly used to propose changes in a collaborative project.

  • Commit
  • Push
  • Merge
  • Pull
The "Push" command in Git is used to propose changes in a collaborative project by uploading the local changes to a remote repository. This is a crucial step in sharing code with others.

During a code review, a team member identifies an issue that could potentially break the build. What Git feature allows for collaborative discussion and resolution?

  • Git Stash
  • Git Revert
  • Git Bisect
  • Git Comments
Git Comments allow collaborative discussion during code reviews. Developers can comment on specific lines of code, addressing issues, proposing solutions, and ensuring a smooth resolution process.

What is the first step you should take when encountering a merge conflict in Git?

  • Stash changes and reset to the last commit
  • Manually resolve the conflict in the code
  • Abandon changes made since the last commit
  • Commit the changes without resolving the conflict
When encountering a merge conflict in Git, the first step is to manually resolve the conflict in the code. This involves identifying and resolving the conflicting changes in the affected files. Stashing changes, resetting to the last commit, or committing without resolving the conflict are not recommended as they may lead to issues in the version history and code consistency.

A team is working on a large project using Git. They need to ensure that their feature development does not interfere with the stable main branch. What Git feature should they use?

  • Git Forks
  • Git Stash
  • Git Branches
  • Git Clone
In this scenario, the team should use Git Branches to create a separate branch for their feature development. This allows them to work on their feature without affecting the stable main branch.

In a large project, how does the use of Git influence the team's ability to adapt to changes rapidly?

  • Enables easy rollbacks
  • Reduces collaboration challenges
  • Enhances code readability
  • Minimizes the need for testing
Git enables easy rollbacks in large projects, allowing teams to quickly adapt to changes. With version control, changes can be tracked, and if necessary, the project can be reverted to a previous state. This flexibility promotes experimentation and innovation while minimizing the fear of irreversible errors, contributing to the team's ability to adapt rapidly.