Home > MCQs > IT & Programming > Git MCQs

Git MCQ

Git Quick Quiz

Question 1 of 10
  • Is possible to have a global .gitignore file?

    Answer & Explanation

    Correct Answer: Yes

    Note: This Question is unanswered, help us to find answer for this one

  • You stashed three sets of changes but cannot remember the contents of the first stash entry. What command would you use to see the details of the changes in the first of the three stash entries?

    Answer & Explanation

    Correct Answer: Git stash show -p stash@{2}

    Note: This Question is unanswered, help us to find answer for this one

  • How would you configure Git to abort a commit if a smoke test script fails?

    Answer & Explanation

    Correct Answer: Create a pre-commit hook to trigger the script.

    Note: This Question is unanswered, help us to find answer for this one

  • What is the staging area or index?

    Answer & Explanation

    Correct Answer: An area that stores information about changes that will be included in the next commit

    Note: This Question is unanswered, help us to find answer for this one

  • Which file in a git repository specifies intentionally untracked files that git should ignore?

    Answer & Explanation

    Correct Answer: .gitignore

    Note: This Question is unanswered, help us to find answer for this one

  • Which initializes a new folder?

    Answer & Explanation

    Correct Answer: git init

    Note: This Question is unanswered, help us to find answer for this one

  • What does the -p option add to the output of the git log command?

    Answer & Explanation

    Correct Answer: It adds patch output that shows a summary listing modified files.

    Note: This Question is unanswered, help us to find answer for this one

  • Which command shows you the version of your git installation.

    Answer & Explanation

    Correct Answer: git --version

    Note: This Question is unanswered, help us to find answer for this one

  • How does this command alter the currently checked-out branch? git reset --soft HEAD^

    Answer & Explanation

    Correct Answer: It sets HEAD to previous commit and leaves changes from the undone commit in the stage/index.

    Note: This Question is unanswered, help us to find answer for this one

  • What is the command for viewing a list of recent commits?

    Answer & Explanation

    Correct Answer: git log

    Note: This Question is unanswered, help us to find answer for this one

  • Git Quick Quiz

    battery

    Poor Results!

    You need a lot of improvement.

    Just don't give up!

    Correct Answers: 0/10

    Start Practicing with our MCQs given below.