Suppose you want to diff a specific file between two branches. The best* git command I’ve found is in this SO answer (only because I’ve found a couple of other sites reference it)
$ git diff branch-name path/to/file
The SO answer says to use `..` in front of branch-name, but I’ve found it works without it. There are WAY too many variants of these commands to keep track of.
I’d love to figure out where this command option is in the official docs but it is pretty overwhelming list.
In a previous tip, you saw how to use VS as your external diff tool. As the blog post title describes, here’s how to do it
$ git difftool branch-name path/to/file
for example, the name of my branch in the image below is `readme` and my filename is `readme.txt`.
I don’t have to provide a path to the readme file since it is at the same location as my current directory.
and volia Visual Studio appears**
* I have no idea if this is the best answer. I’ve read that there’s old syntax and new syntax. I’d love to hear people’s suggestions in the comments!
**I’ve noticed in VS 2017 that VS must be running. Otherwise, the IDE is launched, but the tool doesn’t appear. If you re-run the command via command line, the dif will appear. YMMV
And yeah, I wonder what genre of music I listen to when I write 🙂