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 find which branches are already merged into main?

    Run git branch --merged main to list branches whose commits are all in main, and git branch --no-merged main for the rest. Merged ones are usually safe to delete.

    BeginnerQuick answer1 min read
  2. How do you remove a submodule properly?

    Run git submodule deinit -f path, then git rm -f path, and delete the leftover .git/modules/path folder. Commit the change. Just deleting the folder leaves stale configuration behind.

    AdvancedQuick answer1 min read