Wednesday, April 12, 2023

Xcode Files With Source-Control Status

Jesse Squires:

I usually use Git Tower to review and commit my changes, but you can’t edit files in Git Tower, which means switching back-and-forth between Xcode if you need to make additional modifications. Xcode provides a nice commit interface that allows editing, but it isn’t always easy to use for editing — the side-by-side view forces lines to wrap and sometimes scrolling is wonky. File selection in this view is often glitchy, too.


Instead of trying to use Git Tower or Xcode’s commit UI, you can filter the files in the sidebar to show only ones that have been modified! It’s a very subtle button in the bottom right corner with a +/- icon. Click that and Xcode will hide all the files you haven’t touched. I’ve found this to be helpful for focusing specifically on the changes I’m making and removing all the clutter in large projects.

Xcode has had this feature for a while, but I only started using it recently after Apple fixed the bug where enabling this mode would mess up the outline expansion state in the regular view.

Besides reviewing commits, it’s also useful for regular coding, as it makes it easy to jump back and forth between files that I’m working on in different folders. I find that this often works better than tabs, which require more work to set up which files to Keep Open and to close the ones that are no longer relevant because there isn’t room to view many at a time.

Instead, I tend to use tabs for files that may not be modified but that I frequently want to flip back to. For example, I want quick access to the main English Localizable.strings files in my project because these are hard to access using Open Quickly… with so many for different languages.

3 Comments RSS · Twitter · Mastodon

>but I only started using it recently

Wow, I practically live with this filter on. In fact, I'll occasionally just add a trivial change to files (add a space for example) to bring them in to scope of this flag to get the set of files I'm working on. Since I **always** go over every change when committing I'd dnever forget to remove the pointless change, not that it would matter if I did.

As for Tabs, I do more or less the same as you - I have one window which has two permanent tabs for Localizable and my Notes file which holds all the todo items, any bugs that have been reported (fixing reported bugs is always a high priority so there are generally not many of them), as well as the change notes for the next version. I have another window for Debug (which is automatically activated when I Run), and then I have my Main and Side windows for primary work (essentially the Main one is large and lives on my main display, while the Side one is smaller and lives on the side display most of the time, though they move around as needed.

It's a shame that XCode’s Show only recently edited filter was more useful, but it tends to show way too many files.

I'd *love* to use it more, and with keyboard shortcuts :)

Hunting for that icon with the mouse is rather annoying.

Best case: leave the filter turned on and just use "Open Quickly".

I like to point out again the alternative "SmartGit" as a git-fontend app.

It's a x-platform app, not very Mac-like, but it does a good job giving me not only good overviews of my git repos, and it also has editing features built-in. It even assists with more complex tasks such as change already-pushed commit notes or amending previous commits.

Leave a Comment