-
Notifications
You must be signed in to change notification settings - Fork 57
Implement worktree support for traverse command #1524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## refactor/rename-worktree-git-ops #1524 +/- ##
====================================================================
- Coverage 98.62% 98.61% -0.01%
====================================================================
Files 26 26
Lines 4278 4344 +66
Branches 812 828 +16
====================================================================
+ Hits 4219 4284 +65
Misses 38 38
- Partials 21 22 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
219c5ed to
cae8edf
Compare
|
@PawelLipski I've tested it locally and works flawlessly! Thanks! The only thing (which I'm not sure it should addressed) is a slight UX/flow difference when the branch in a worktree is dirty and cannot be manipulated (e.g. rebased). Without the worktree, after something fails when traversing, git-machete leaves the current tree in the currently processing branch, so it's easy to fix it and proceed with another traverse. With worktrees, it cd into a worktree but when it exists with an error, you're still in the current worktree. Slightly annoying, but not blocking! Worth considering having this UX unified. |
Yeah, I think it's going to be hard to work around, that's more of an OS limitation (Linux/macOS/Windows) — a process can't change its parent's working directory (Reddit). I'll instead make |
07fd8ec to
34652bc
Compare
36e601c to
6e3d672
Compare
- Add get_worktrees() and get_worktree_path() methods to GitOperations - Modify traverse to cd into worktrees where branches are checked out - Cache worktree information to avoid repeated git worktree list calls - Add informative messages when changing directories to worktrees - Add comprehensive tests for worktree handling including detached HEAD cases - Add integration test for traverse with multiple worktrees Fixes #1522
41cb114 to
64f2b56
Compare
Based on PR #1528
Chain of upstream PRs as of 2025-11-14
PR Rename worktree-related methods in GitClient #1528:
develop←refactor/rename-worktree-git-opsrefactor/rename-worktree-git-ops←improve/1522-worktree-switch-traverseFixes #1522
TBD: how about checkout from other commands like
git machete go? ➡️ leave as is, there's no easy way to switch shell's wd from inside Python process; just failTODO: mention in docs ➡️ done