Categories
git note to self programming tips

how to think of “git diff” using branch names

This post is more of a note to myself to remember how to think of certain git diff commands but it might be useful to other newbie-ish users of git. This is from my own experimentation, since I couldn’t find a good newbie-understandable explanation of this on the Interwebs.

git diff <branch name> – means what would change if we applied the current working HEAD of the branch we are on, including all unstaged/uncommitted changes, to the named branch.

git diff <branch 1> <branch 2> – means what would change if we applied <branch 2> onto <branch 1>