I wanted to compare a file I had checked out on my master branch to a file on another tracking branch on my Mac that was not checked out. Now, I want to leave you with a little git diff trick I finally dug up. I tested this on a couple of files, and it worked. So I snipped the above code out of the your_repo_directory/.git/config and put it instead at the end of my ~/.gitconfig file, with the goal that I want these configurations to work anytime I’m using git on my Mac. So, if you add this into the file, and save everything, then you issue a command for Git to use a tool to run a diff on two files, they will launch into BBEdit.Īt this point, I danced a little and posted a celebratory tweet.īut as I went to write this up, this evening, I stumbled over that mythical. I put them in as the search results told me too, and this whole thing works, so I kept them in. Also, I have no idea about the other arguments at the end. But now, bbdiff is a full-fledged CLI app, so it can be run from any where, no longer requiring the file path. My guess is that because when this was written, it was based on a script which require listing where the script lived. If you’ve Googled this yourself, you’ll see the last bit was different. At the end of the file (though, I suppose it could be anywhere), I appended the following:Ĭmd = bbdiff -wait -resume "$LOCAL" "$REMOTE" I found entries in it which is where shortcuts for repo were stored.
You can open and edit this straight through BBEdit. Within the directory of where your repo resides, you’ll find: So I learned that you can actually edit a different file and set these settings per repo, if you had multiple repos on your Mac. When I googled to find out how to tell Git to use BBEdit’s excellent diff tool for this, the search hits told me to edit a. Git allows you to compare two files’ contents with git diff, or you can tell it to use another tool to do the same by using git difftool. Now that we have these tools at our disposal, we can tell Git to use them instead of its defaults. That has nothing to do with this little project, but if you’re geek enough to be changing diff tools within Git, you’re geek enough to be editing system-level files with BBEdit. If you bought the Mac App Store version, you’ll need to install the command line tools from a download from Bare Bones’s site:Ĭommand Line Tools for BBEdit - Mac App Store Version onlyĪside: While you’re there, you may want to download the script to enabled authenticated saves.
There are two concurrent versions of BBEdit, with important differences: If you’re running a version downloaded from Bare Bones, you had to install the command line tools at first run, (If you didn’t then, I believe there’ll be an option in your BBEdit menu). The last one is what we’ll be using today, bbdiff which pipes data or files direct into BBEdit’s file comparison tool. The first one, bbedit is what you’d use in a standard command line argument in place of something like vim or emacs.
These allow you to send standard output to BBEdit and launch files into BBEdit as if it were a command line app (but your output shows up in your beloved graphical editor). As for 2012, and BBEdit version 10.1.1 and Git 1.7.9.2 here’s how I told Git to use BBEdit for it’s difftoolįirst, if you’re using BBEdit, and you haven’t installed your command line tools, you’ll need to. I Googled this several times, but the info I discovered wasn’t up to date. How to use BBEdit to look at differences between two files that are tracked with Git