Interview Prep/Git & GitHub/Commits, branches and tags

How do you see what changed between two branches, tags or commits?

BeginnerConceptCommits, branches and tags
Answer

Use git diff with two refs and choose the range operator deliberately. Two dots compares the tips directly; three dots compares the second tip against the merge base, which matches what a PR shows.

git diff v1.3.0 v1.4.0 --stat
git diff main...feature
git log --oneline main..feature
All Git & GitHub questions Roadmap: Git & GitHub

More on Commits, branches and tags