Interview Q&A / Git & GitHub

INTERVIEW Q&A · 97 QUESTIONS

Git & GitHub interview questions

Branching, merge vs rebase, resolving conflicts and pull requests, the way teams actually work.

  1. How do you update a submodule to its latest version?

    Go into the submodule, pull the wanted commit, then commit the changed pointer in the parent. Or run git submodule update --remote to fetch the tracked branch's latest commit for you.

    IntermediateQuick answer1 min read
  2. What is a Git submodule?

    A submodule lets one repository contain another repository at a fixed commit. The parent stores only the URL and the exact commit hash, so the child's history stays separate.

    IntermediateQuick answer1 min read
  3. Why is a submodule in detached HEAD state, and is that a problem?

    The parent pins an exact commit, so Git checks the submodule out at that commit, not on a branch. It is normal. To edit the submodule, check out a branch inside it first, or commits can get lost.

    IntermediateQuick answer1 min read