What is git push?

Why Interviewers Ask This

Foundational questions like this help interviewers calibrate the rest of the interview. A confident, accurate answer signals that you have solid Git & GitHub basics — a prerequisite for any developer role.

Answer

git push uploads local commits to the remote repository. Basic usage: git push — push current branch to its tracked remote; git push origin main — explicitly push local main to remote origin's main; git push origin feature-login — push a feature branch. First push of a new branch: git push -u origin feature-login-u sets the upstream tracking reference so future git push/git pull work without specifying remote and branch. Push tags: git push --tags — push all local tags; git push origin v1.0 — push a specific tag. Force push (dangerous): git push --force / -f — overwrites remote history with local history. Used after rebase or amend. NEVER force push to shared branches (main, develop) — you overwrite teammates' history. Use git push --force-with-lease instead — safer: only force pushes if no one else has pushed since your last fetch (prevents overwriting others' work). Delete remote branch: git push origin --delete feature-login.

Common Mistake

Don't just define the term — demonstrate that you understand when to use it and when not to. Showing awareness of trade-offs is what separates average from strong Git & GitHub candidates.