Skip to content

keith/git-relative-status

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-relative-status

git-relative-status is meant to provide a parseable output format for relative paths in a git repo. This is useful for providing a fuzzy finding interface for editors or shell functions.

Installation

Homebrew:

brew install keith/formulae/git-relative-status

Manually, after installing rust:

cargo install

You need to have source ~/.cargo/env somewhere in your shell configuration, then git-relative-status will be available from ~/.cargo/bin/git-relative-status.

Examples

$ pwd
/foo/bar/repo
$ echo "hi" >> README.md
$ git relative-status
README.md
$ mkdir foo; cd foo
$ git relative-status
../README.md

Why not use git status

If you want a parseable format, you should be using --porcelain to get a stable format (although realistically it probably won't change much in this case). Unfortunately this is not relative. This makes it difficult to fuzzy find files from a nested directory in a repo.

Why rust

$ time git-relative-status # Rust
0.07s user 0.24s system 166% cpu 0.189 total
$ time git-relative-status.py # Python
0.14s user 0.30s system 124% cpu 0.358 total

TODO

  • This currently doesn't output the specific status, assuming consumers won't care about it for the original use case. This should also be an option.
  • File renames will still show in the format from -> to. In this case it should only print the to.
  • Verify the behavior with submodules. I have no idea if this will work with submodules at all. Specifically:
    • If you're in a submodule directory, where will the paths be relative to
    • If you're in a directory containing a nested submodule, I assume just the submodule will be available. It would be nice to show any dirty files from the submodule too.

About

A CLI for printing the status in a git repo with relative file paths

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors