Rebase
// Definition
Replaying your branch's commits on top of another branch's latest state, producing a linear history instead of a merge commit. `git rebase main` makes your feature branch look as if you started it from the current `main`. Powerful for a clean history, dangerous if used on shared branches — it rewrites commit hashes.
// Why it matters
Rebase keeps history linear and readable, which makes bisecting and reviewing easier — but the QA-relevant warning is that rebasing shared branches rewrites history others have, breaking their clones. Knowing when rebase is safe (your own unpushed work) vs dangerous (shared branches) prevents a class of team-wide Git disasters.
// How to test
git switch feature/login-tests git rebase main # replay my commits on top of latest main → linear history # ⚠️ NEVER rebase a branch others have pulled — it rewrites hashes # safe: only rebase your own un-pushed (or solely-yours) commits
// Common mistakes
- Rebasing a shared/pushed branch others depend on (rewrites their history)
- Resolving the same conflict repeatedly across many replayed commits without
--continuediscipline - Confusing rebase (rewrites) with merge (preserves) and picking the wrong one
// Related terms
Branch
An independent line of development in a Git repository — a movable pointer to a commit, letting you work on a feature or fix in isolation without touching the main line. Branches are cheap and disposable; the typical flow is branch off `main`, commit work, open a pull request, merge back.
Commit
A saved snapshot of changes in a Git repo, with a message describing what changed and a unique hash identifying it. Commits are the atomic unit of history — each one is a revertible, reviewable point you can return to. Good commits are small and focused; the message explains why, not just what.
Merge Conflict
A state Git enters when two branches modify the same part of a file in incompatible ways and cannot be automatically combined. Git marks the conflict with `<<<<<<<`, `=======`, and `>>>>>>>` markers and waits for a developer to choose which version (or a manual combination) should survive. Merge conflicts are most common on long-lived feature branches or when several people edit the same test file simultaneously.