@gw-tools/gw 0.60.1 → 0.61.0-beta.68.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +48 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -832,6 +832,7 @@ When working in a worktree, you cannot easily checkout main to pull the latest c
832
832
  #### Options
833
833
 
834
834
  - `--from <branch>`: Update from specified branch instead of defaultBranch (e.g., `--from develop`)
835
+ - `--from-pr <n|url>`: Update from a pull request by number or GitHub PR URL (mutually exclusive with `--from`)
835
836
  - `--remote <name>`: Specify remote name (default: "origin")
836
837
  - `-m, --merge`: Force merge strategy (overrides configured strategy)
837
838
  - `-r, --rebase`: Force rebase strategy (overrides configured strategy)
@@ -854,9 +855,21 @@ gw update --rebase
854
855
  # Update from a specific branch
855
856
  gw update --from develop
856
857
 
857
- # Preview what would happen
858
+ # Update from a pull request (by number)
859
+ gw update --from-pr 42
860
+
861
+ # Update from a pull request (by GitHub URL)
862
+ gw update --from-pr https://github.com/owner/repo/pull/42
863
+
864
+ # Rebase onto a PR head instead of merging
865
+ gw update --from-pr 42 --rebase
866
+
867
+ # Preview what would happen without executing
858
868
  gw update --dry-run
859
869
 
870
+ # Preview merge from a PR without executing
871
+ gw update --from-pr 42 --dry-run
872
+
860
873
  # Force update even with uncommitted changes (not recommended)
861
874
  gw update --force
862
875
 
@@ -864,6 +877,39 @@ gw update --force
864
877
  gw update --remote upstream
865
878
  ```
866
879
 
880
+ #### Updating from a Pull Request (`--from-pr`)
881
+
882
+ The `--from-pr` flag lets you merge or rebase the current branch onto a PR's
883
+ head commit without checking out the PR branch. This is useful when you want
884
+ to test how your feature branch integrates with a colleague's PR that is still
885
+ in review.
886
+
887
+ ```bash
888
+ # Merge PR #42 into the current worktree branch
889
+ gw update --from-pr 42
890
+
891
+ # Rebase the current branch onto PR #42
892
+ gw update --from-pr 42 --rebase
893
+
894
+ # Works with full GitHub URLs too (trailing paths and fragments are stripped)
895
+ gw update --from-pr https://github.com/owner/repo/pull/42/files
896
+ ```
897
+
898
+ How it works:
899
+
900
+ 1. Resolves the PR number from the bare number or GitHub URL
901
+ 2. Guards against non-GitHub remotes (`--from-pr` requires a GitHub remote)
902
+ 3. Force-fetches `refs/pull/<n>/head` into `refs/remotes/<remote>/pr/<n>`
903
+ (the `+` prefix ensures force-pushed PRs always overwrite stale cached refs)
904
+ 4. Proceeds with the normal merge/rebase pipeline using the fetched ref
905
+ 5. Optionally enriches the display label with the PR title via `gh` (silent if `gh` is absent or unauthenticated)
906
+
907
+ Requirements:
908
+
909
+ - A GitHub remote (the remote URL must contain `github.com`)
910
+ - Network access to fetch the PR ref
911
+ - `gh` CLI is **optional** — only used to show the PR title in output
912
+
867
913
  #### How It Works
868
914
 
869
915
  1. Fetches the latest version of the target branch from remote (e.g., `origin/main`)
@@ -881,6 +927,7 @@ gw update --remote upstream
881
927
 
882
928
  - When using `--from` with an explicit branch, the command requires a successful fetch from the remote to ensure you're updating with the latest code. If the fetch fails (network issues, branch doesn't exist on remote, authentication problems), the command will exit with a detailed error message and suggestions for resolution.
883
929
  - When no `--from` is specified (using default branch) or when no remote is configured, the command will warn about fetch failures but allow the update using the local branch.
930
+ - When using `--from-pr`, a successful fetch is always required. The command exits with a clear error message if the fetch fails.
884
931
 
885
932
  **Update strategy:**
886
933
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gw-tools/gw",
3
- "version": "0.60.1",
3
+ "version": "0.61.0-beta.68.1",
4
4
  "description": "A command-line tool for managing git worktrees - copy files between worktrees with ease",
5
5
  "keywords": [
6
6
  "git",