Git MCQs with answers Page - 6

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 • 828.03K Points
Coach

Q. What does git revert do?

  • (A) Deletes a commit
  • (B) Resets commit history
  • (C) Creates a new commit that undoes changes
  • (D) Removes files permanently

A

Admin • 828.03K Points
Coach

Q. Which command shows commits that are in branch A but not in branch B?

  • (A) git diff A B
  • (B) git log A..B
  • (C) git log B..A
  • (D) git compare

A

Admin • 828.03K Points
Coach

Q. What is the purpose of the staging area?

  • (A) Store backups
  • (B) Test code
  • (C) Prepare changes before commit
  • (D) Store remote files

A

Admin • 828.03K Points
Coach

Q. Which Git object stores file contents?

  • (A) Commit
  • (B) Tree
  • (C) Blob
  • (D) Tag

A

Admin • 828.03K Points
Coach

Q. Which command lists ignored files as well?

  • (A) git status
  • (B) git status -u
  • (C) git status --ignored
  • (D) git ignored

A

Admin • 828.03K Points
Coach

Q. Which command squashes commits during an interactive rebase?

  • (A) pick
  • (B) edit
  • (C) squash
  • (D) drop

A

Admin • 828.03K Points
Coach

Q. What does git reflog track?

  • (A) Remote logs
  • (B) All file changes
  • (C) Updates to HEAD references
  • (D) Merge conflicts

A

Admin • 828.03K Points
Coach

Q. Which command restores a deleted commit using reflog?

  • (A) git restore
  • (B) git checkout <hash>
  • (C) git reset <hash>
  • (D) git revert <hash>

A

Admin • 828.03K Points
Coach

Q. Which Git hook runs before a commit message is created?

  • (A) post-commit
  • (B) pre-push
  • (C) pre-commit
  • (D) commit-msg

A

Admin • 828.03K Points
Coach

Q. What does git submodule allow?

  • (A) Multiple remotes
  • (B) Nested repositories
  • (C) Multiple branches
  • (D) Multiple users

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ