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.

The git ______ command is used to switch branches or restore working tree files.

  • checkout
  • switch
  • restore
  • branch
The correct option is "checkout." The git checkout command in Git is versatile and can be used for various purposes, including switching branches and restoring working tree files. For example, git checkout switches to the specified branch.

How can you view the changes introduced in a specific commit using Git?

  • git show
  • git diff
  • git log -p
  • git log --oneline
To view the changes introduced in a specific commit, you can use git show . This command displays the details of the commit, including the changes made.

What is a Git hook?

  • A script that runs before or after events
  • A branch in Git
  • A Git repository
  • A command to undo the last commit
A Git hook is a script that runs automatically before or after certain Git events, such as committing or merging. It allows developers to customize and automate processes in response to specific actions in the Git workflow.

After performing a rebase, you may need to use git ______ to incorporate the changes into the base branch.

  • apply
  • merge
  • commit
  • pull
After performing a rebase, you can use git apply to incorporate the changes into the base branch. This step is necessary to complete the rebase process and update the branch with the rebased changes.

How can branching strategies in Git enhance build automation processes?

  • By using feature branches
  • By adopting a GitFlow workflow
  • By creating release branches
  • By following a linear development approach
In Git, branching strategies like GitFlow can enhance build automation by providing a structured approach to managing feature development, releases, and hotfixes. GitFlow specifically defines branches such as feature branches for new features and release branches for stable releases, streamlining the build process.

What are the challenges of using Git in conjunction with build automation tools?

  • Managing dependencies and ensuring consistent builds.
  • Difficulty in integrating Git with Continuous Integration (CI) systems.
  • Limited support for parallel builds.
  • Inability to version control build artifacts.
Challenges of using Git with build automation tools include managing dependencies and ensuring consistent builds. Versioning build artifacts and integrating with CI systems can also pose difficulties.

In migrating a large codebase to Git, what factors influence the choice of using a monorepo versus multiple smaller repositories?

  • Easier management of dependencies in a monorepo compared to smaller repositories.
  • Facilitates better code isolation and release management in smaller repositories.
  • Monorepo is always preferred for large codebases, irrespective of other factors.
  • Multiple smaller repositories lead to improved build and deployment processes.
Choosing Between Monorepo and Multiple Repositories in Git

When merging branches, which Git command is used to create a new commit that represents the combined changes?

  • git push
  • git commit
  • git merge
  • git branch
The correct command for merging branches and creating a new commit is git merge. This command combines the changes from different branches into the current branch, resulting in a new commit that represents the merged state.

A team working on a project hosted on GitHub wants to ensure code style consistency. Which feature should they implement?

  • Git Hooks
  • Git Submodules
  • Git LFS
  • Git Tags
To ensure code style consistency in a project hosted on GitHub, the team should implement Git Hooks. Git Hooks allow developers to run custom scripts before or after certain Git events, enabling them to enforce coding standards and other practices.