Git MCQs with answers Page - 5

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 changes the last commit message?

  • (A) git commit --edit
  • (B) git commit --amend
  • (C) git reword
  • (D) git reset --soft

A

Admin • 828.03K Points
Coach

Q. What is a detached HEAD state?

  • (A) Broken repository
  • (B) HEAD points directly to a commit
  • (C) No commits exist
  • (D) Remote branch issue

A

Admin • 828.03K Points
Coach

Q. Which Git command lists all branches including remote?

  • (A) git branch
  • (B) git branch -r
  • (C) git branch -a
  • (D) git remote

A

Admin • 828.03K Points
Coach

Q. Which command permanently removes a remote?

  • (A) git remote delete
  • (B) git remote remove
  • (C) git remote -d
  • (D) git remote erase

A

Admin • 828.03K Points
Coach

Q. Which Git feature ensures data integrity?

  • (A) Branching
  • (B) SHA-1 hashing
  • (C) Staging area
  • (D) Hooks

A

Admin • 828.03K Points
Coach

Q. Which command shows the difference between staging and last commit?

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

A

Admin • 828.03K Points
Coach

Q. Which command removes a file from Git but keeps it locally?

  • (A) git rm
  • (B) git rm --cached
  • (C) git delete
  • (D) git remove --local

A

Admin • 828.03K Points
Coach

Q. Which command is used to sign commits cryptographically?

  • (A) git sign
  • (B) git commit -S
  • (C) git verify
  • (D) git secure

A

Admin • 828.03K Points
Coach

Q. Which command creates and switches to a new branch in one step?

  • (A) git branch new
  • (B) git checkout new
  • (C) git checkout -b new
  • (D) git switch new

A

Admin • 828.03K Points
Coach

Q. Which command is the modern alternative to git checkout for switching branches?

  • (A) git move
  • (B) git change
  • (C) git switch
  • (D) git shift

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