Compare files across branches

on January 21, 2020. in Development. A 1 minute read.

After some bigger rebases in git, I have to compare a file between two branches, most often master and the current branch.

git diff master my-branch -- file/to/diff

The diff will show what was added to the file in my-branch, as well what was removed. Helps a lot with fixing conflicts during rebases gone bad.

Happy hackin’!

Tags: git, diff, branches.

Get the next article to your inbox

If you'd like, you can get the next article I write to your email inbox.