Git & GitHub Setup for MLOps -1

                                                                Git & GitHub Setup for MLOps

Q1. Conflict in GIT

When does a conflict arise in git?

Choose the correct answer from below:

A.    Always when 2 developers raise pull requests simultaneously.
B.    Always when 2 developers change the project simultaneously.
C.    When the same line of code of a particular file is changed, in 2 different merging branches A and B.
D.    When the same file is deleted in 2 branches A and B, and we are trying to merge them.

Ans: D

Correct Option:
When the same line of code of a particular file is changed, in 2 different merging branches A and B.
Explanation:

  • Conflicts generally arise when two people have changed the same lines in a file, or if one developer deleted a file while another developer was modifying it.
  • In these cases, Git cannot automatically determine what is correct. Conflicts only affect the developer conducting the merge, the rest of the team is unaware of the conflict.
  • Git will mark the file as being conflicted and halt the merging process. It is then the developers’ responsibility to resolve the conflict.

Q2. Forking and Cloning

How is forking different from cloning?

Choose the correct answer from below, please note that this question may have multiple correct answers

A.    Cloning allows you to push and pull to the UPSTREAM repo using git pull/push commands, forking doesn’t even with pull requests.
B.    Forking creates an independent copy of someone else’s GIT repo.
C.    We can push to the UPSTREAM respository using git push command incase of forking.
D.    Cloning creates a linked copy that will be synced with the target repo.

Ans: B,D

Correct Options:

  • Forking creates an independent copy of someone else’s GIT repo.
  • Cloning creates a linked copy that will be synced with the target repo.

Explanation:

  • Using Fork operation we are creating a copy of the repository in which changes are supposed to be made and reflected without affecting the original project.
  • After making the changes we can contribute back to the original repository using Pull Requests.
  • When we create a new repository on GitHub or Any repository on Github, it exists as a remote location where our / any other repository is stored. Cloning a repository creates a local copy on our computer so that we can sync between both the local and remote locations of the repository. We can not contribute to the repository unless we are made the collaborator of the repository.
  • Cloning is an ideal case when one wants to get his own copy of a repository where he may not be contributing to the original project.

Q3. What will you do?

In Git, if you want to make your local repository reflect changes that have been made in a remote (tracked) repository, what action will you take?

Choose the correct answer from below:

A.    Pull
B.    Push
C.    Merge
D.    Clone

Ans: A

Correct Option:
Pull

Explanation:
The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content.

Q4. GIT clone

What action does Git Clone perform?

Choose the correct answer from below, please note that this question may have multiple correct answers

A.    Makes a local copy of the repository
B.    Creates a working directory
C.    Commits a new branch
D.    All options are correct

 

Ans: A, B

Correct Options

  • Makes a local copy of the repository
  • Creates a working directory

Explanation:

  • git clone is a Git command line utility which is used to target an existing repository and create a clone, or copy of the target repository.
  • It creates a working directory for the user which is the same as the target repository.

Q5. Git DVCS

Git is a distributed version control system because:

Choose the correct answer from below:

A.    It brings the local copy of the complete repo to every team member’s local system.
B.    It is centralized.
C.    It resides in every team member’s computer

Ans: A

Correct Option:
It brings the local copy of the complete repo to every team member’s local system.

Explanation:

  • When you have a git repository on your machine, it is self-contained. It works perfectly on its own. There’s no need to have a server running somewhere to enable you to use git.
  • A distributed version control system (DVCS) brings a local copy of the complete repository to every team member’s computer, so they can commit, branch, and merge locally. The server doesn’t have to store a physical file for each branch — it just needs the differences between each commit.

 

Comments