Git MCQs with answers Page - 8

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. Which command removes untracked directories as well?

  • (A) git clean -f
  • (B) git clean -d
  • (C) git clean -fd
  • (D) git reset --hard

A

Admin • 828.03K Points
Coach

Q. Which Git file stores repository-specific configuration?

  • (A) ~/.gitconfig
  • (B) /etc/gitconfig
  • (C) .git/config
  • (D) .gitignore

A

Admin • 828.03K Points
Coach

Q. Which command sets a global Git username?

  • (A) git set user.name
  • (B) git config user.name
  • (C) git config --global user.name
  • (D) git global user.name

A

Admin • 828.03K Points
Coach

Q. What does git shortlog mainly show?

  • (A) File size summary
  • (B) Commit summary by author
  • (C) Branch list
  • (D) Tag details

A

Admin • 828.03K Points
Coach

Q. Which command compares working tree with the staging area?

  • (A) git diff
  • (B) git diff --cached
  • (C) git diff HEAD
  • (D) git status

A

Admin • 828.03K Points
Coach

Q. Which command lists tags in a repository?

  • (A) git show tag
  • (B) git tag
  • (C) git tags
  • (D) git branch -t

A

Admin • 828.03K Points
Coach

Q. What is an annotated tag?

  • (A) A lightweight reference
  • (B) A tag with message and metadata
  • (C) A deleted tag
  • (D) A remote tag

A

Admin • 828.03K Points
Coach

Q. Which command deletes a remote branch?

  • (A) git branch -d origin/branch
  • (B) git push origin --delete branch
  • (C) git remote delete branch
  • (D) git remove origin branch

A

Admin • 828.03K Points
Coach

Q. Which command shows commits reachable from HEAD?

  • (A) git show HEAD
  • (B) git log
  • (C) git reflog
  • (D) git history

A

Admin • 828.03K Points
Coach

Q. Which Git command searches commit messages?

  • (A) git find
  • (B) git log --grep
  • (C) git search
  • (D) git commit --search

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