exa

Git integration

When you're listing files inside a Git repository, exa can query it and display the Git status for each file, letting you know what has been added or modified since the previous commit.

This feature is not enabled by default, and must be used with the long view. To use it, pass the --git command-line options to exa.

When enabled, the metadata table will have an extra Git column containing two characters. The first is the staged status, when the file has chunks staged but not committed; the second is the unstaged status, when it hasn’t. It’s possible to partially stage a file, and have both.

Only two types of change are currently tracked by exa:

  • N for a new file;
  • M for changes to an existing file.
git status
modified: icon.scss
Untracked files:
text-link.scss

exa --long --git
Permissions Size User Date Modified Git Name
.rw-r--r--   260 ben  23 Nov 17:47   -M icon.scss
.rw-r--r--   612 ben  23 Nov 17:47   -- media.scss
.rw-r--r--    59 ben  25 Nov 17:23   -N text-link.scss
.rw-r--r--   155 ben  23 Nov 17:47   -- unselectable.scss

Why would I want Git in my files list, anyway?

Because you get to see the Git information alongside everything else. Yes, it’s already trivial to just run git status when you’re in your shell. But when you need to double-check exactly which files have been staged, you really need to see it clearly!

Why is the Git column not listed by default?

Speed, mostly. Because listing the files in a Git repository involves a lot more work than just listing the files in a folder, enabling Git support by default would make the average exa invocation a lot slower. So it’s opt-in, rather than opt-out.

Do I need to have Git installed?

No — exa uses the Rust bindings to libgit2, so Git support is statically linked into the binary. This means that you don’t need a particular version of Git to be installed to use this fetaure.

How can I tell if my version of exa supports Git?

Run exa --version, and +git should appear in the list of enabled feature flags. Alternatively, you can just run exa --long --git and see if it displays an error!

Have you considered support for other version control systems?

Although Git is currently the only version control system supported, there’s no reason why others couldn’t join it. The only requirement is that it must have a library with Rust bindings, so exa can statically link it and remain a single executable.