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 →
- Why does git push get rejected with 'non-fast-forward', and what should you do?
The remote branch has commits you do not have, so your push would overwrite them. Pull (or fetch and rebase) first to combine the work, then push again. Do not force-push over shared work.
BeginnerQuick answer1 min read - Why don't tags appear on GitHub after git push, and how do you push them?
git push does not send tags by default. Push one with git push origin v1.0, or all with git push --tags. Tags are not created on the remote until you do this.
BeginnerQuick answer1 min read - What is the difference between git push --force and --force-with-lease?
--force overwrites the remote branch no matter what. --force-with-lease overwrites only if the remote is still where you last saw it, so you do not wipe out commits a teammate pushed meanwhile.
IntermediateQuick answer1 min read