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. What makes a good Git commit message?

    A short imperative summary line of about 50 characters, a blank line, then an optional body explaining why the change was made. Describe the reason, not just what the diff already shows.

    BeginnerQuick answer1 min read
  2. Why are commit messages written in the imperative mood?

    Git's own messages, like 'Merge branch' or 'Revert commit', are imperative, and the convention completes the sentence 'If applied, this commit will...'. It keeps the log consistent and short.

    BeginnerQuick answer1 min read
  3. How do you fix the message of a commit that is not the latest?

    Run git rebase -i, mark that commit as reword, save, and edit the message. Only do this for commits not yet shared, since every commit after it also gets a new hash.

    IntermediateQuick answer1 min read
  4. What are Conventional Commits?

    Conventional Commits is a message format type(scope): description, with types like feat, fix, docs and chore. It makes history readable and lets tools generate changelogs and pick version bumps automatically.

    IntermediateQuick answer1 min read