https://github.com/towry/path-git-format
Cli tool to format paths from stdin with git branch information
https://github.com/towry/path-git-format
autojump cli fzf-addons rust zoxide
Last synced: 3 months ago
JSON representation
Cli tool to format paths from stdin with git branch information
- Host: GitHub
- URL: https://github.com/towry/path-git-format
- Owner: towry
- License: mit
- Created: 2024-01-31T09:04:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-24T01:38:03.000Z (about 2 years ago)
- Last Synced: 2025-10-13T20:22:37.032Z (9 months ago)
- Topics: autojump, cli, fzf-addons, rust, zoxide
- Language: Rust
- Homepage:
- Size: 25.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/towry/path-git-format/actions/workflows/ci.yml)  
# path-git-format
Cli tool to format path(s) with version control information.
Supports:
- **Git** repositories - displays branch names
- **Jujutsu (jj)** repositories - displays bookmark names
## Usage
```
printf "$PWD" | path-git-format --format "{path}: {branch}" | fzf
```
### Use with zoxide query | [tldr; fish script](./extension/zoxide-path-git-format.fish)
[zoxide](https://github.com/ajeetdsouza/zoxide)'s `query` command returns list of paths:
```
zoxide query --list --score
```
output:
```txt
100 /Users/towry/projects/a
80 /Users/towry/projects/b
01 /Users/towry/projects/c
```
We can use `path-git-format` to format those paths with VCS branch/bookmark information.
```bash
zoxide query --list --score | path-git-format --nth 1 --format "{path}: {branch}" | fzf
```
So you can use it with `fzf` to search paths along with git branch or jj bookmark information.
## Features
- **Git Support**: Automatically detects Git repositories and displays the current branch
- **Jujutsu Support**: Automatically detects Jujutsu repositories and displays the first bookmark
- **Fallback**: For non-VCS directories, returns just the path
- **Filter Option**: Use `--filter` to exclude paths without VCS information
## Install
### Install binary release
1. [Visit the Release page to download the appropriate tarball for your system](https://github.com/towry/path-git-format/releases)
2. Extract the binary file and put it under your `$PATH` like `/user/local/bin`.
### Prerequisites
- cargo
- git
- jj (optional, for Jujutsu repository support)
### Install with cargo
```
cargo install --git https://github.com/towry/path-git-format
```
### Build and Install from source
```bash
git clone --depth=1 git@github.com:towry/path-git-format.git
cd path-git-format
# will install `path-git-format` into `/usr/local/bin`
make install
```
## Snippets
See [extension/](./extension)
- `zoxide-path-git-format.fish`: fish functions to quickly jump to folder with git
branch fuzzy match.
- `nvim-fzf-lua-zoxide-folders.lua`: In neovim, you can open fzf-lua folders
picker with zoxide integration, to quickly change cwd like you does in
terminal.
Video presentation:
https://github.com/towry/path-git-format/assets/8279858/30c5d166-9a30-4445-ac90-4593fb01fa6c