Interview Q&A / Git & GitHub
Git & GitHub interview questions
Branching, merge vs rebase, resolving conflicts and pull requests, the way teams actually work.
Prefer rapid revision? Practise Git & GitHub short interview answers →
- How do you resolve a merge conflict in Git?
Run git status to see the conflicted files, open each one and find the markers <<<<<<<, ======= and >>>>>>>. Edit the code to the correct final version, delete the markers, then git add the file and run git commit (or git rebase --continue during a rebase). Test before you push.
BeginnerIn-depth3 min read - What is a pull request, and how does the code review workflow work?
A pull request (PR) is a request to merge your branch into another branch, usually main. You push a branch, open a PR with a clear description, automated checks run, teammates review and comment, you push fixes, and once approved the PR is merged and the branch deleted.
BeginnerIn-depth3 min read - What is git stash, and when would you use it?
git stash saves your uncommitted changes in a temporary stack and gives you a clean working directory, so you can switch branches or pull without committing half-done work. Later, git stash pop brings the changes back and removes them from the stack; git stash apply brings them back but keeps the stash.
BeginnerIn-depth3 min read - What is the difference between Git and GitHub?
Git is a version control tool that runs on your own computer and records the history of your code. GitHub is a website that hosts Git repositories online and adds collaboration features like pull requests, code review, issues and CI. You can use Git without GitHub, but GitHub is built on top of Git.
BeginnerIn-depth3 min read