Git Branching and Pull Requests Quiz

StaunchLion avatar
StaunchLion
·
·
Download

Start Quiz

Study Flashcards

18 Questions

What is the correct pronunciation of Git as per Linus Torvalds?

Ghi-T

Which statement accurately describes the concept of local repositories in Git?

Local repositories contain work done only by the user who owns it.

What does a remote repository serve as in Git?

A centralized location accessible to all users.

Why do users push their new updates to a remote repository in Git?

To share their updates with others and maintain a centralized source of truth.

In Git, what is the primary purpose of pulling updates from a remote repository?

To incorporate changes made by other users into one's local repository.

Why does Git support non-linear development with thousands of parallel branches?

To encourage collaboration and experimentation with different code paths.

Which branching strategy is more suited for teams practicing Continuous Integration and Continuous Deployment (CI/CD)?

Trunk-based development

What is the primary purpose of Pull Requests (PRs) in Git workflows?

To review and discuss changes before merging

Which Git best practice is recommended for minimizing the impact of a problematic commit?

Keep commits atomic and focused on a single change

What is the recommended practice for updating a feature branch with the latest changes from the main branch?

Pull the changes from origin/main before creating a new branch

Which Git best practice is recommended for safekeeping unfinished work?

Push local feature branch commits to the remote repository

Which Git best practice aids in understanding the purpose and context of a commit?

Writing clear and descriptive commit messages

What is the main purpose of creating a feature branch in a Git workflow?

To ensure the main branch contains only code that is tested and working

What is the recommended practice for the lifespan of a feature branch?

Feature branches should be deleted after the feature is complete and merged to the main branch

What is the recommended practice for working directly on the main branch?

It is better to avoid working directly on the main branch, and instead use feature branches

What is the purpose of a Pull Request (PR) in a Git workflow?

To request feedback and review on proposed changes before merging

What is the recommended practice for merging changes to the main branch?

Merge changes to the main branch frequently, to avoid large merge conflicts

What is the recommended naming convention for feature branches?

Use a descriptive name that reflects the feature being developed

Study Notes

Git Overview

  • Git is the de-facto standard for Version Control Systems (VCS) today.
  • Created by Linus Torvalds (Linux creator) in 2005.
  • Git supports non-linear development (thousands of parallel branches) and is fully distributed.

Git Basic Concepts

  • Git does not need a Centralized Repository to work.
  • Every user maintains a local repository of their own.
  • Local repositories contain original work, user's own work, and selected work from others.
  • Users can commit and update their local repository without interference from others.

Git Repositories

  • There are two types of repositories: Local and Remote.
  • Local repositories are owned by each user.
  • Remote repositories are centralized locations accessible to all users, serving as a single source of truth.

Git Best Practices

  • Break down big features into smaller ones and add them one at a time.
  • Keep commits atomic, focusing on one part of the feature.
  • Commit often, even if the work is not done.
  • Pull changes from the origin/main branch before creating a new branch from local/main.

Git General Best Practices

  • Push local feature branch commits to Remote often, even if unfinished.
  • Use branches to organize work.
  • Write good commit messages to help others.
  • Select one branching strategy (Git Workflow) and stick with it.

Git Branching

  • Create a branch for each feature, avoiding multiple features in a single branch.
  • Ideally, only one person should work on one feature branch.
  • Feature branches should be short-lived and deleted after merging to the master branch.
  • Merge early and often to avoid merge conflicts.
  • Keep the master branch clean, only containing production-ready code.

Additional Topics

  • Continuous Integration and Continuous Deployment (CI/CD)
  • Compare Trunk based development workflow with GitFlow workflow
  • Pull Requests (PRs) for collaborating on changes

Test your knowledge on how proposed changes are handled in Git through feature branches and Pull Requests. Understand the process of verifying, accepting, and merging changes from feature branches to the main branch.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Git and GitHub Basics Quiz
5 questions

Git and GitHub Basics Quiz

RazorSharpAlexandrite avatar
RazorSharpAlexandrite
Git Version Control System Benefits Quiz
24 questions
Git Basics: Commits and Branching
18 questions
Use Quizgecko on...
Browser
Browser