To ignore certain files from being tracked in Git, list them in a _______ file.

  • .exclude
  • .gitignore
  • exclude.txt
  • ignorefile
The correct option is "b) .gitignore." The .gitignore file is used to specify files or patterns that Git should ignore. This helps in preventing unnecessary files from being tracked, such as temporary files or compiled binaries.

A team member needs to review changes made in the past two weeks, but there are too many commits to check individually. What Git command should they use?

  • git log --since="2 weeks ago"
  • git show --last=2.weeks
  • git diff --since="2 weeks ago"
  • git blame --since="2 weeks ago"
The correct option is to use "git log --since="2 weeks ago"" to view the commit history for the past two weeks. Git log provides a detailed overview of commits, making it easier for the team member to review changes over the specified period.

In an open source project, a critical bug is discovered in a release. How should the maintainers use Git to address this issue promptly while maintaining the integrity of the project?

  • Cherry-pick
  • Revert
  • Reset
  • Squash
The maintainers should use the "Revert" option. Reverting creates a new commit that undoes the changes introduced by a specific commit, effectively addressing the critical bug while maintaining the integrity of the project history. It is a safer option than resetting or squashing, as it keeps a clear record of the fix without altering existing commits.

Describe the role of 'feature branches' in Git's branching model.

  • Long-lived branches for ongoing features
  • Temporary branches for hotfixes
  • Branches for experimental changes
  • Short-lived branches for documentation
'Feature branches' are long-lived branches created for ongoing features or tasks. They allow developers to work on features independently and then integrate them back into the main branch when ready. This promotes a clean and organized development process.

How does a lightweight tag in Git differ from an annotated tag?

  • Contains only a reference to a commit
  • Includes additional information like a message
  • Points to a branch
  • Represents a merge commit
A lightweight tag in Git only contains a reference to a specific commit, while an annotated tag includes additional information such as a tagger name, email, date, and a tagging message. Annotated tags are recommended for important releases or milestones.

What is the command to list all the tags in a Git repository?

  • git show-tags
  • git tags
  • git list-tags
  • git tag -l
The correct option is git tag -l. This command lists all the tags in the Git repository. It's essential for getting an overview of available tags, especially in larger projects with numerous releases.

In the context of a large project, how does Git facilitate code reviews and quality assurance?

  • Branching and pull requests for isolated code reviews
  • Integration with automated testing tools
  • Detailed commit history and blame feature
  • Linear versioning history
Git facilitates code reviews and quality assurance in large projects through features like branching and pull requests, which enable isolated code reviews. Additionally, it integrates seamlessly with automated testing tools and provides a detailed commit history and blame feature.

The team needs to integrate a project within another project while maintaining separate version control histories. Which Git feature is the most appropriate?

  • Subtree Merge
  • Cherry-pick
  • Rebase
  • Merge Commit
Subtree merge allows integrating an external project into another by merging in only the parts needed, maintaining separate histories. It's useful for combining projects without losing their individual version control contexts.

To cherry-pick a specific commit, you use the command git cherry-pick ________.

  • commit-hash
  • git-apply
  • git-merge
  • git-rebase
The correct option is a) commit-hash. This command allows you to apply the changes introduced by a specific commit onto your current branch. You need to provide the commit hash of the desired commit.

How does Git's branching model enhance Agile methodologies in large-scale development?

  • Facilitates parallel development
  • Simplifies project management
  • Reduces the need for communication
  • Improves code quality
Git's branching model enhances Agile methodologies by facilitating parallel development. Multiple branches enable teams to work on different features simultaneously, promoting collaboration and faster delivery. The ability to isolate features in branches helps manage project complexity and supports Agile principles of adaptability and quick response to changes.