DEV Community

Cover image for βœ… *Git & GitHub Interview Questions & Answers* πŸ§‘β€πŸ’»πŸŒ
ssekabira robert sims
ssekabira robert sims

Posted on

βœ… *Git & GitHub Interview Questions & Answers* πŸ§‘β€πŸ’»πŸŒ

1️⃣ What is Git?

A: Git is a distributed version control system to track changes in source code during development.

2️⃣ What is GitHub?

A: GitHub is a cloud-based platform that hosts Git repositories and supports collaboration, issue tracking, and CI/CD.

3️⃣ Git vs GitHub

  • Git: Version control tool (local)
  • GitHub: Hosting service for Git repositories (cloud-based)

4️⃣ What is a Repository (Repo)?

A: A storage space where your project’s files and history are saved.

5️⃣ Common Git Commands:

  • git init β†’ Initialize a repo
  • git clone β†’ Copy a repo
  • git add β†’ Stage changes
  • git commit β†’ Save changes
  • git push β†’ Upload to remote
  • git pull β†’ Fetch and merge from remote
  • git status β†’ Check current state
  • git log β†’ View commit history

6️⃣ What is a Commit?

A: A snapshot of your changes. Each commit has a unique ID (hash) and message.

7️⃣ What is a Branch?

A: A separate line of development. The default branch is usually main or master.

8️⃣ What is Merging?

A: Combining changes from one branch into another.

9️⃣ What is a Pull Request (PR)?
A: A GitHub feature to propose changes, request reviews, and merge code into the main branch.

πŸ”Ÿ What is Forking?

A: Creating a personal copy of someone else’s repo to make changes independently.

1️⃣1️⃣ What is .gitignore?

A: A file that tells Git which files/folders to ignore (e.g., logs, temp files, env variables).

1️⃣2️⃣ What is Staging Area?

A: A space where changes are held before committing.

1️⃣3️⃣ Difference between Merge and Rebase

  • Merge: Keeps all history, creates a merge commit
  • Rebase: Rewrites history, makes it linear

1️⃣4️⃣ What is Git Workflow?

A: A set of rules like Git Flow, GitHub Flow, etc., for how teams manage branches and releases.

1️⃣5️⃣ How to Resolve Merge Conflicts?

A: Manually edit the conflicted files, mark resolved, then commit the changes.

πŸ’¬ Tap ❀️ if you found this useful!

Top comments (0)