Git MCQs with answers Page - 7

Here, you will find a collection of MCQ questions on Git. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833K Points
Coach

Q. Which command updates submodules after cloning?

  • (A) git submodule update --init
  • (B) git pull submodule
  • (C) git submodule fetch
  • (D) git clone --sub

A

Admin • 833K Points
Coach

Q. Which command compares two branches?

  • (A) git diff branch1 branch2
  • (B) git log branch1..branch2
  • (C) git compare branch1 branch2
  • (D) Both A and B

A

Admin • 833K Points
Coach

Q. Which option in git log shows a graphical branch structure?

  • (A) --tree
  • (B) --branch
  • (C) --graph
  • (D) --visual

A

Admin • 833K Points
Coach

Q. Which command verifies signed commits?

  • (A) git verify
  • (B) git log --verify
  • (C) git log --show-signature
  • (D) git check-sign

A

Admin • 833K Points
Coach

Q. What does git archive do?

  • (A) Creates repository backup
  • (B) Exports files without .git directory
  • (C) Compresses commits
  • (D) Stores history

A

Admin • 833K Points
Coach

Q. Which Git command helps bisect bugs?

  • (A) git debug
  • (B) git find
  • (C) git bisect
  • (D) git trace

A

Admin • 833K Points
Coach

Q. Which command marks a commit as good during bisect?

  • (A) git bisect good
  • (B) git bisect pass
  • (C) git bisect ok
  • (D) git bisect clean

A

Admin • 833K Points
Coach

Q. Which command ends a bisect session?

  • (A) git bisect stop
  • (B) git bisect end
  • (C) git bisect reset
  • (D) git bisect exit

A

Admin • 833K Points
Coach

Q. Which command shows the name of the current branch?

  • (A) git status
  • (B) git branch
  • (C) git branch --show-current
  • (D) git current

A

Admin • 833K Points
Coach

Q. What does git pull --rebase do?

  • (A) Deletes local commits
  • (B) Merges using a merge commit
  • (C) Reapplies local commits after fetching
  • (D) Resets the branch