MCQ

Git MCQs – Multiple Choice Questions and Answers – Part 1

Multiple choice questions and answers (MCQs) on Git to prepare for exams, tests, and certifications. These questions are taken from a real written exam and some parts are taken from an interview. So you will find questions on basic techniques such as pushing the code, pulling the code, versioning, git commands, and more. This quiz will easily prepare anyone to pass their online test.
 

1. What is the git command that downloads your repository from GitHub to your computer?

A $ git push

B $ git commit

C $ git fork

D $ git clone

D
“git clone” command downloads an existing Git repository to the local computer. Here is an example:

$ git clone https://github.com/stackhowto/git-tuto-course.git

 

 

2. What command is used to upload your code and changes to GitHub?

A $ git add

B $ git upload

C $ git push

D $ git status

C

 

3. How to initialize the local repository with git?

A $ git start

B $ git init

C $ git pull

D $ git clean

B
To create a new repository, you will use the “git init” command. “git init” is a command you use when you first set up a new repository. Running this command will create a new .git subdirectory in your current directory. It will also create a new master branch.

$ git init <project directory>

 

 

4. How do I get code from another repository on GitHub?

A Forking through the GitHub interface.

B $ git pull-request

C $ git fork

D $ git clone

A

 

5. How to check the status of your local repository since your last commit?

A $ git check

B $ git commit

C $ git diff

D $ git status

D

 

 

6. How do I add files to a commit?

A $ git stage

B $ git commit

C $ git add

D $ git reset

C

 

7. How to save the current state of your code in git?

A By validating the modifications staged with $ git commit

B By adding all the changes and staging them with $ git stage

C By adding all the changes and organizing them with $ git add

D By creating a new commit with $ git init

A

 

 

8. What shortcut to stage all the changes you have?

A $ git push -am “Message”

B $ git commit add .

C $ git commit .

D $ git add .

C

 

9. Which command you use to check the history of your repository?

A $ git checkout

B $ git fetch

C $ git log

D $ git diff

C

 

10. Which command will let you know who modified a file?

A $ git blame

B $ git diff

C $ git log

D $ git log –source

A
Syntax : $ git blame <file-name>

 

mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *