Add `gwa` command for interactively creating git worktrees with
fzf-powered branch selection.
Usage:
- `gwa`: select a branch to create a worktree for
- `gwa <new-branch>`: create a new branch from a selected base branch
- 2+ args: fall back to `git worktree add` directly
New worktrees are created under `$FORGIT_WORKTREE_ADD_DIR` (defaults to
`<repo-root>/.wt/`) and the shell automatically cd's into the result.
- stash_push: use _git_add instead of _git_stash for file path
completion, consistent with zsh side
- switch_branch: use _git_checkout_branch instead of undefined
_git_switch_branch
Several PUBLIC_COMMANDS (attributes, switch_branch, stash_push, ignore)
had no corresponding entries in the completion scripts, causing
incomplete tab completion.
- Extract dim formatting into _forgit_print_dim() to replace hardcoded
ANSI sequences in _forgit_branch_list()
- Add empty state check and alt-l lock toggle reload for worktree delete
- Fix worktree path completion to handle paths with spaces using -z flag
- Add worktree command completion for bash and zsh
Add worktree browser (gwt) and worktree delete selector (gwd) with:
- Interactive worktree list with lock status, branch info, and age
- Preview showing working tree status and recent commits
- Ctrl-Y to copy worktree path, Alt-L to toggle lock/unlock
- Shell integration for zsh (with cd) and fish (with cd)
- Tab completions for zsh, bash, and fish
- Documentation in README with keybindings and options
Co-Authored-By: Sufien Tout <sufientout@gmail.com>
Introducing `show` as a new subcommand of `forgit`, an interactive
version of `git show`. The configured default alias is `gso`.
Alt-T can be used to toggle between showing the diff and the commit
message in the fzf preview window.
The new command in used instead of `forgit diff` when pressing enter
in `forgit log`. This fixes the display of diffs for merge commits.
**Note**: we have a requirement for the `fzf` version now. The minimum
required `fzf` version is 0.49.0. If the installed version is lower,
forgit will exit with an error message.
Fixes#416.
Moved the completion definitions for zsh that previously were in completions/git-forgit.zsh and had to be sourced manually on shell startup into completions/_git-forgit, where they are automatically handled by compinit on shell startup. Sourcing a file to get completions is no longer necessary for zsh users.
If you're having issues after updating, and completions for commands such as `forgit::add` or aliases like `ga` aren't working, remove your completions cache (~/.zcompdump) and restart your shell.
Simplified _git-forgit to allow it to be called from within the completion script on the first run of a session.
---------
Co-authored-by: sandr01d <88739791+sandr01d@users.noreply.github.com>
fish's builtin git completion automatically registers git-forgit completions as completions for forgit subcommand of git. Therefore this PR provides completions for both formats git-forgit and git forgit.
Simple subcommands get the completion list from __fish_git_* functions, while others requiring more than 1 __fish_git_* completion sources reuse the completion items from the corresponding git commands.
When using forgit via the shell plugin, source 'git-forgit.bash'
explicitly after 'forgit.plugin.zsh' to enable tab completion for forgit
shell functions and aliases.
When using forgit as a subcommand of git, put 'git-forgit.bash' in one
of the following places and it will be loaded automatically on tab
completion of 'git forgit' or any configured git aliases of it:
- /usr/share/bash-completion/completions
- ~/.local/share/bash-completion/completions