Fatskills
Practice. Master. Repeat.
Study Guide: Comp. Sci and Programming Basics: Version Control GitHub GitLab Workflow
Source: https://www.fatskills.com/bsc-cs/chapter/version-control-github-gitlab-workflow

Comp. Sci and Programming Basics: Version Control GitHub GitLab Workflow

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~6 min read

Concept Summary

  • GitHub and GitLab are web-based platforms that enable version control and collaboration on software development projects.
  • Git is a version control system that tracks changes made to code over time, allowing developers to revert to previous versions if needed.
  • A Git repository (repo) is a central location where all project files are stored, and changes are tracked.
  • Branching in Git allows developers to work on separate versions of the codebase without affecting the main project.
  • Pull requests are used to review and merge changes from one branch into another, ensuring that code changes are thoroughly tested and validated.

Questions


WHAT (definitional)

  • Q1: What is a Git repository?
  • Answer: A Git repository is a central location where all project files are stored, and changes are tracked.
  • Real-world example: A company's software development team uses a Git repository to store and manage their project code.
  • Misconception cleared: A Git repository is not just a folder on a computer, but a centralized location where all team members can access and contribute to the project.
  • Q2: What is a pull request?
  • Answer: A pull request is a request to merge changes from one branch into another, allowing for code review and validation.
  • Real-world example: A developer submits a pull request to merge their changes into the main branch, which is reviewed by a team lead before being approved.
  • Misconception cleared: A pull request is not just a way to merge code, but also a way to ensure that changes are thoroughly reviewed and tested before being integrated into the main project.
  • Q3: What is branching in Git?
  • Answer: Branching in Git allows developers to work on separate versions of the codebase without affecting the main project.
  • Real-world example: A developer creates a new branch to work on a feature, while the main branch remains unchanged until the feature is complete and merged.
  • Misconception cleared: Branching in Git is not just for creating new projects, but also for working on separate versions of an existing project.

WHY (causal reasoning)

  • Q1: Why is version control important in software development?
  • Answer: Version control is important because it allows developers to track changes, collaborate on projects, and revert to previous versions if needed.
  • Real-world example: A company uses version control to track changes to their software, which helps them identify and fix bugs more efficiently.
  • Misconception cleared: Version control is not just for tracking changes, but also for ensuring that multiple developers can work on the same project without conflicts.
  • Q2: Why is code review important in software development?
  • Answer: Code review is important because it allows developers to review and validate changes before they are integrated into the main project.
  • Real-world example: A team lead reviews a developer's code changes before merging them into the main branch, which helps ensure that the code is correct and efficient.
  • Misconception cleared: Code review is not just for finding bugs, but also for improving code quality and ensuring that best practices are followed.
  • Q3: Why is collaboration important in software development?
  • Answer: Collaboration is important because it allows multiple developers to work together on a project, share knowledge, and learn from each other.
  • Real-world example: A team of developers collaborate on a project, sharing their expertise and experience to create a high-quality product.
  • Misconception cleared: Collaboration is not just for working on small projects, but also for creating complex and large-scale software systems.

HOW (process/application)

  • Q1: How do you create a new branch in Git?
  • Answer: You can create a new branch in Git using the git branch command, followed by the name of the branch.
  • Real-world example: A developer creates a new branch called feature/new-feature using the git branch feature/new-feature command.
  • Misconception cleared: Creating a new branch in Git is not just for creating a new project, but also for working on separate versions of an existing project.
  • Q2: How do you merge changes from one branch into another?
  • Answer: You can merge changes from one branch into another using the git merge command, followed by the name of the branch.
  • Real-world example: A developer merges changes from the feature/new-feature branch into the main branch using the git merge feature/new-feature command.
  • Misconception cleared: Merging changes in Git is not just for combining code, but also for resolving conflicts and ensuring that changes are thoroughly reviewed and validated.
  • Q3: How do you create a pull request in GitLab?
  • Answer: You can create a pull request in GitLab by clicking on the "New merge request" button, selecting the source and target branches, and adding a description.
  • Real-world example: A developer creates a pull request in GitLab to merge their changes into the main branch, which is reviewed by a team lead before being approved.
  • Misconception cleared: Creating a pull request in GitLab is not just for merging code, but also for ensuring that changes are thoroughly reviewed and validated before being integrated into the main project.

CAN (possibility/conditions)

  • Q1: Can you create a new branch in Git if you are not the owner of the repository?
  • Answer: Yes, you can create a new branch in Git if you have push access to the repository.
  • Real-world example: A developer with push access creates a new branch in a repository, which is then reviewed and merged by the repository owner.
  • Misconception cleared: Creating a new branch in Git is not just for the repository owner, but also for developers with push access.
  • Q2: Can you merge changes from one branch into another if there are conflicts?
  • Answer: Yes, you can merge changes from one branch into another even if there are conflicts, but you will need to resolve the conflicts manually.
  • Real-world example: A developer merges changes from one branch into another, but encounters conflicts that need to be resolved manually.
  • Misconception cleared: Merging changes in Git is not just for combining code, but also for resolving conflicts and ensuring that changes are thoroughly reviewed and validated.
  • Q3: Can you create a pull request in GitLab if you are not a member of the project?
  • Answer: No, you cannot create a pull request in GitLab if you are not a member of the project.
  • Real-world example: A developer tries to create a pull request in GitLab, but is not a member of the project and is unable to create the pull request.
  • Misconception cleared: Creating a pull request in GitLab is not just for any developer, but also for members of the project.

TRUE/FALSE (misconception testing)

  • Q1: True or False: Git is a version control system that only tracks changes to files, but not directories.
  • Answer: FALSE
  • Real-world example: Git tracks changes to both files and directories, allowing developers to manage their project structure and history.
  • Misconception cleared: Git is not just for tracking file changes, but also for managing project structure and history.
  • Q2: True or False: A pull request is only used for merging changes from one branch into another.
  • Answer: FALSE
  • Real-world example: A pull request is also used for code review and validation, ensuring that changes are thoroughly reviewed and validated before being integrated into the main project.
  • Misconception cleared: A pull request is not just for merging code, but also for ensuring that changes are thoroughly reviewed and validated.
  • Q3: True or False: Branching in Git is only used for creating new projects.
  • Answer: FALSE
  • Real-world example: Branching in Git is also used for working on separate versions of an existing project, allowing developers to experiment and test new features without affecting the main project.
  • Misconception cleared: Branching in Git is not just for creating new projects, but also for working on separate versions of an existing project.


ADVERTISEMENT