Git & GitHub Course
Git & GitHub
/
Advanced

Advanced Interview Questions

Definition

Questions targeting Senior Developers, focusing on Git internals, destructive commands, history rewriting, and CI/CD architecture.

Explain Like I'm New

Proving you can rescue a junior developer who accidentally deleted the production database credentials and force-pushed it to the server.

Real World Example

Explaining the difference between Soft, Mixed, and Hard resets.

Common Use Cases

  • •Senior Developer / DevOps Interviews

Terminal Output

bash / terminal
/* Q: What is a detached HEAD state? A: Normally, HEAD points to a Branch pointer (like `main`), which then points to a Commit. If you check out a specific commit hash (e.g., `git checkout a1b2c3d`), HEAD detaches from the branch and points directly to the commit. If you make new commits in a detached HEAD state, they do not belong to any branch. If you switch away, those commits will become orphaned and eventually deleted by the garbage collector. To save them, you must create a new branch: `git checkout -b new-branch`. */

Interview Questions

basic

  • What command allows you to combine multiple commits into one?

intermediate

  • What is the `git reflog` and why is it important?

Flash Cards

Question

Combine commits?

Click to reveal answer
Answer

Interactive Rebase (`git rebase -i`), using the 'squash' option.

Question

What is reflog?

Click to reveal answer
Answer

The Reference Log records every time the HEAD pointer moves on your local machine. It is the ultimate safety net. Even if you use `git reset --hard` and 'permanently' delete commits, they are still in the reflog for 30 days and can be fully recovered.