kjuulh f3cc24c9fc
Some checks failed
continuous-integration/drone/push Build encountered an error
docs: add projects and shell integration sections to README
2026-03-20 14:41:54 +01:00
2024-09-23 19:45:34 +02:00
2024-09-22 16:25:44 +02:00
2024-09-12 19:15:42 +02:00
2024-09-22 14:55:41 +02:00
2024-09-14 20:45:49 +02:00
2024-09-14 20:45:49 +02:00
2025-03-04 12:16:38 +00:00
2025-03-04 12:16:38 +00:00
2025-01-02 09:44:37 +01:00
2026-02-10 12:40:51 +01:00
2024-09-12 19:15:42 +02:00

Git Now

https://gitnow.kjuulh.io/

Git Now is a utility for easily navigating git projects from common upstream providers. Search, Download, and Enter projects as quickly as you can type.

example gif

Installation

cargo (b)install gitnow

# You can either use gitnow directly (and use spawned shell sessions)
gitnow

# Or install gitnow scripts (in your .bashrc, .zshrc) this will use native shell commands to move you around
eval $(gitnow init zsh)
git-now # Long 
gn # Short alias

Reasoning

How many steps do you normally do to download a project?

  1. Navigate to github.com
  2. Search in your org for the project
  3. Find the clone url
  4. Navigate to your local github repositories path
  5. Git clone <project>
  6. Enter new project directory

A power user can of course use gh repo clone to skip a few steps.

With gitnow

  1. git now
  2. Enter parts of the project name and press enter
  3. Your project is automatically downloaded if it doesn't exist in an opinionated path dir, and move you there.

Configuration

Configuration lives at ~/.config/gitnow/gitnow.toml (override with $GITNOW_CONFIG).

Custom clone command

By default gitnow uses git clone. You can override this with any command using a minijinja template:

[settings]
# Use jj (Jujutsu) instead of git
clone_command = "jj git clone {{ ssh_url }} {{ path }}"

Available template variables: ssh_url, path.

Worktrees

gitnow supports git worktrees (or jj workspaces) via the worktree subcommand. This uses bare repositories so each branch gets its own directory as a sibling:

~/git/github.com/owner/repo/
├── .bare/          # bare clone (git clone --bare)
├── main/           # worktree for main branch
├── feature-login/  # worktree for feature/login branch
└── fix-typo/       # worktree for fix/typo branch

Usage:

# Interactive: pick repo, then pick branch
gitnow worktree

# Pre-filter repo
gitnow worktree myproject

# Specify branch directly
gitnow worktree myproject -b feature/login

# Print worktree path instead of entering a shell
gitnow worktree myproject -b main --no-shell

All worktree commands are configurable via minijinja templates:

[settings.worktree]
# Default: "git clone --bare {{ ssh_url }} {{ bare_path }}"
clone_command = "git clone --bare {{ ssh_url }} {{ bare_path }}"

# Default: "git -C {{ bare_path }} worktree add {{ worktree_path }} {{ branch }}"
add_command = "git -C {{ bare_path }} worktree add {{ worktree_path }} {{ branch }}"

# Default: "git -C {{ bare_path }} branch --format=%(refname:short)"
list_branches_command = "git -C {{ bare_path }} branch --format=%(refname:short)"

For jj, you might use:

[settings]
clone_command = "jj git clone {{ ssh_url }} {{ path }}"

[settings.worktree]
clone_command = "jj git clone {{ ssh_url }} {{ bare_path }}"
add_command = "jj -R {{ bare_path }} workspace add --name {{ branch }} {{ worktree_path }}"
list_branches_command = "jj -R {{ bare_path }} bookmark list -T 'name ++ \"\\n\"'"

Available template variables for worktree commands: bare_path, worktree_path, branch, ssh_url.

Projects

gitnow supports scratch-pad projects that group multiple repositories into a single directory. This is useful when working on features that span several repos.

# Create a new project (interactive repo selection)
gitnow project create my-feature

# Create from a template
gitnow project create my-feature -t default

# Open an existing project (interactive selection)
gitnow project

# Open by name
gitnow project my-feature

# Add more repos to a project
gitnow project add my-feature

# Delete a project
gitnow project delete my-feature

Project directories live at ~/.gitnow/projects/ by default. Templates live at ~/.gitnow/templates/. Both are configurable:

[settings.project]
directory = "~/.gitnow/projects"
templates_directory = "~/.gitnow/templates"

Commands that navigate to a directory (gitnow, gitnow project, gitnow project create, gitnow worktree) will cd you there when using the shell integration. Commands that don't produce a path (project add, project delete, update) run normally without changing your directory.

Shell integration

The recommended way to use gitnow is with shell integration, which uses a chooser file to communicate the selected path back to your shell:

eval $(gitnow init zsh)
git-now    # or gn

When you run git-now, the shell wrapper:

  1. Creates a temporary chooser file
  2. Runs gitnow with the GITNOW_CHOOSER_FILE env var pointing to it
  3. If gitnow writes a path to the file, the wrapper cds there
  4. If the file is empty (e.g. after git-now project delete), no cd happens

This works uniformly for all subcommands:

git-now                      # pick a repo and cd there
git-now project              # pick a project and cd there
git-now project create foo   # create project and cd there
git-now project delete foo   # deletes project, no cd
git-now worktree             # pick repo+branch worktree, cd there

You can also set the chooser file manually for scripting:

GITNOW_CHOOSER_FILE=/tmp/choice gitnow project
# or
gitnow --chooser-file /tmp/choice project
Description
No description provided
Readme 6.9 MiB
v0.3.7 Latest
2026-03-20 17:46:47 +01:00
Languages
Rust 98.9%
Shell 0.9%
VHDL 0.2%