# Changelog

All notable changes to **gwt** are documented here.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project follows [Semantic Versioning](https://semver.org/).

## [Unreleased]

## [1.5.1] — 2026-08-04

### Added
- **Open a worktree as a workspace, in a real new window — `{ws}`.** `GWT_OPEN_CMD` now understands a second placeholder: `{ws}` expands to a generated `.code-workspace` file instead of the bare folder path, so `GWT_OPEN_CMD='code -n {ws}'` gives you a **guaranteed new window** with the worktree as a workspace root. Because the file is saved on disk, closing the window never asks you to "save workspace?" — that prompt only belongs to the untitled workspaces you get from adding a folder ad hoc. Files live at `~/.gwt/workspaces/<repo>/<branch>.code-workspace`, are reused on later opens so VS Code keeps that worktree's tabs and layout, and are **deleted automatically** when `gwr` or `gwclean` removes the worktree. `{}` and the default `code -n {}` are unchanged, so nothing changes unless you opt in — and this is the missing half of the 1.4.1 fix: `--add` can't be made to work, since it hijacks the last active window, silently discards a companion `-n`, can't populate a window it just created, and can write into a saved `.code-workspace` you already had open.

## [1.5.0] — 2026-07-28

### Added
- **Reach across all your projects — cross-repo `-g`.** `gwo`, `gws`, `gwr`, `gwx`, and `gwl` now take `-g` (`--global`): the fzf picker spans **every** repo under `GWT_WORKTREE_DIR`, each entry labeled `<repo>/<branch>`, so you can open, switch to, run a command in, or remove a worktree of any project without `cd`-ing into it first. It's **automatic when you're outside a repo** — a bare `gwo`/`gws`/`gwr`/`gwx`/`gwl` from anywhere gives you the cross-project picker; `-g` is just the explicit opt-in for when you're inside one repo but want to reach another. Global mode is picker-driven (a branch name would be ambiguous across repos), and `gwx -g` picks a single worktree (it can't combine with `-a`). `gwa`, `gwclean`, and `gwp` stay scoped to the current repo.

### Changed
- **BREAKING — `gwl -a` is now `gwl -g`.** The global-dashboard flag was renamed to match the new cross-repo `-g` convention, and it's now also auto-on when you run `gwl` outside a repo. `gwl -a` no longer works — use `gwl -g` (bundles as `gwl -gbp`).

## [1.4.1] — 2026-07-24

### Fixed
- **`gwa -o` / `gwo` now open the worktree in a single new window.** The default `GWT_OPEN_CMD` was `code -n && code -a {}`, whose `--add` step could attach the folder to whichever VS Code window was last active (usually the one you launched from) while the `--new-window` step left a stray empty window behind. It's now `code -n {}` — one call, one new window, nothing added to your current window.

## [1.4.0] — 2026-07-24

### Added
- **Open a new worktree immediately, install in the background.** `gwa -d` (`--detach`) runs `GWT_POST_INIT_CMD` (e.g. `pnpm install`) in the background so `gwa -od <branch>` opens your editor right away instead of freezing the terminal until install finishes; its output → `~/.gwt/logs/<repo>/<branch>.post-init.log`. Set `GWT_POST_INIT_DETACH=1` to make that the default (with `gwa --wait` to block just once). gwa now also bundles short flags, so `gwa -omd` works.

## [1.3.0] — 2026-07-24

### Added
- **Run a command inside a worktree without leaving yours.** `gwx <branch> -- <command>` runs any command in another worktree's directory and streams the output right where you are — no `cd`, no new window. The exit code passes through, so `gwx feat -- pnpm test && …` works. No `<branch>`? An fzf picker lets you choose. Add `-d` to run it in the background (it survives the terminal closing); its output goes to `~/.gwt/logs/<repo>/<branch>.log`. Add `-a` to run the command across **every** worktree of the repo in parallel — it continues on error and prints a per-worktree summary; `-da` launches one background job per worktree.

## [1.2.2] — 2026-07-23

### Changed
- Added an SVG logo/icon and a **Features** table to the README.

## [1.2.1] — 2026-07-22

### Changed
- Polished the README (added a **Why** section and npm badges) and expanded the npm keywords to make the package easier to find. The changelog now ships inside the published package.

### Fixed
- Corrected the `LICENSE` copyright holder, which was a leftover template name.

## [1.2.0] — 2026-07-22

### Added
- **Jump straight into a new worktree.** `gwa -s` (`--switch`) creates or adopts a worktree and drops you right into it (`cd`), in one step. Plain `gwa` still leaves your shell where it is.
- **`gwa` shows fresh branches.** It now refreshes from `origin` first, so a teammate's just-pushed branch appears in the picker — and `gwa <their-branch>` adopts it — without a manual `git fetch`. No more accidentally creating a new local branch when that name already exists on the remote. On by default; disable with `GWT_GWA_FETCH=0` or skip once with `gwa --no-fetch`. Offline just carries on with the last-known list.
- **See where a branch came from.** `gwt` now remembers what each new branch was cut from, and `gwl -b` (`--base`) shows it in a BASE column — handy when you branch off something other than `main`. Branches made outside gwt show `—`.
- **Bundle `gwl` flags.** Combine short flags like `gwl -abp` (= `-a -b -p`), in any order — the separate and long forms still work too.

## [1.1.6] — 2026-07-22

### Added
- **Removing worktrees is now near-instant.** `gwr` and `gwclean` move a worktree to the Trash instead of slowly deleting every file — a huge difference on worktrees with a big `node_modules`. Bonus: it's recoverable, so you can restore from the Trash if you change your mind.
- **You can see it working.** A little spinner shows `removing <branch>…` and turns into `✓ removed <branch>` when it's done, so a large removal never looks frozen.
- **Use your own trash tool.** `trash` is picked up automatically if it's installed; set `GWT_TRASH_CMD` to use a different one (e.g. `trash-put`, `gio trash`), or to nothing to keep the plain git removal. `gwt doctor` shows which one is active.

### Changed
- Nothing about safety changed: a worktree with real uncommitted changes is still never removed unless you pass `--force`.

## [1.1.5] — 2026-07-22

### Added
- **Choose your clipboard tool.** The command behind `gwa -c` is now configurable via `GWT_CLIPBOARD_CMD` — `pbcopy` on macOS by default, or set `xclip` / `wl-copy` on Linux. Shown in `gwt doctor`.

## [1.1.4] — 2026-07-22

### Changed
- **`gwt update` got smarter.** It now checks for a newer version first and simply tells you `✓ you have the latest version` when you're already current, instead of reinstalling every time. (The `-v` flag was removed — the installer's own output is always shown now.)

### Fixed
- **`gwt update` no longer reports the update twice** — you get a single `updated to …` confirmation.

## [1.1.2] — 2026-07-22

First public release as **`@bojangles/gwt`** — the git-worktree toolkit, lifted out of a
personal dotfiles setup into a standalone tool anyone can install in one command.

### Added
- **One-command install.** `npx @bojangles/gwt` — no `sudo`, nothing system-wide. Re-run it anytime to upgrade.
- **The worktree commands.** `gwa` (create/adopt), `gws` (switch), `gwo` (open in your editor), `gwr` (remove), `gwl` (status dashboard), `gwclean` (tidy up stale worktrees), and `gwp` (prune). When you don't name a branch, an fzf picker helps you choose one.
- **Helpers that work from anywhere.** `gwt doctor` checks your setup, plus `gwt update`, `gwt uninstall`, and `gwt -h` / `-v`.
- **Sensible, adjustable defaults.** Set where worktrees live, how they open, which files are copied into each new one, and a command to run right after creating one.

---

### Earlier — 0.1.x (2024)

The `0.1.x` releases were a **different, create-only tool** and are **deprecated**.
They are unrelated to the current plugin — install the latest instead:
`npx @bojangles/gwt@latest`.

[Unreleased]: https://github.com/bojangles-m/gwt/compare/v1.5.0...HEAD
[1.5.0]: https://github.com/bojangles-m/gwt/releases/tag/v1.5.0
[1.4.1]: https://github.com/bojangles-m/gwt/releases/tag/v1.4.1
[1.4.0]: https://github.com/bojangles-m/gwt/releases/tag/v1.4.0
[1.3.0]: https://github.com/bojangles-m/gwt/releases/tag/v1.3.0
[1.2.2]: https://github.com/bojangles-m/gwt/releases/tag/v1.2.2
[1.2.1]: https://github.com/bojangles-m/gwt/releases/tag/v1.2.1
[1.2.0]: https://github.com/bojangles-m/gwt/releases/tag/v1.2.0
[1.1.6]: https://github.com/bojangles-m/gwt/releases/tag/v1.1.6
[1.1.5]: https://github.com/bojangles-m/gwt/releases/tag/v1.1.5
[1.1.4]: https://github.com/bojangles-m/gwt/releases/tag/v1.1.4
[1.1.2]: https://github.com/bojangles-m/gwt/tree/v1.1.2
