You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for treating worktrees like regular repos #907
The way it works is, when you run git worktree add, git checks out whatever branch you gave it (or creates a new branch - worktrees can never be on the same branch as the main clone), and creates a .git file that contains:
gitdir: [path to the original clone]/.git/worktrees/[name of worktree directory]
A worktree is a "view" of the original clone set to a different branch. Committing on a worktree is the same as committing on the original clone, you can cherry-pick/merge as usual, the database is shared. merge states are separate, as is the reflog.
Reacted by Ben Brandt, Tomas Achmedovas, Elan Feingold, Curtis Buys, Aaron Breckenridge, Sam Se Silver, Arti Villa, Emanuel Pilz, Laszlo Magyar, Troy Hinckley and 113 more
Reacted by Nikita Amelchenko, Daniel Rotärmel, Chester, Moslem Deris, Mithil Patil, Hegyi Áron Ferenc, z-yang, Charles Burgess, Serafín Martín, Polina Cherkasova and 6 more
@JESii ~ I swear I tried it before and it didn't work, but you're right, I was able to open a worktree directory inside the app and it seemed to work perfectly (commit & push both worked fine). The one tweak which would be awesome is displaying the worktree as part of the sidebar, since right now worktree and parent look identical.
Reacted by Jed Fox, Parker Atkins, Ignat Remizov, Thomas Bergamin and Filip Heinel
At least when I last tested it, if you add a repo or worktree directory to GitHub desktop and maybe perform some other action, not sure, it will create spurious and incorrect staging records for other worktrees in the same repository.
I haven't had the direction from my management to actually look into the code to see what's going on but if feels like a simple bug where something is making a bad assumption or something.
So while GitHub Desktop recognizes worktree directories just fine, there is a bad bug with how it handles repositories that use work trees.
For the ServiceNow platform documentation we use git repositories that manage multiple versions of the platform documentation on different branches, where we have at least four versions under active support and development. These repositories are very large (10s of GB of history, ~6GB of working data on any version's branch).
Our authors have a long-standing practice of cloning each version's branch into a separate directory, but today they make a separate clone (we currently use Eclipse as the git GUI for authors and JGit does not recognize work trees at all).
Work trees would be the ideal solution to this crazy work practice (it was put in place years ago) and we very much want to replace Eclipse with GitHub Desktop as our supported GUI solution for ServiceNow writers. Support for worktree is not a must-have--authors can continue to make separate clones as they do today and it will work just fine--but we would really like work trees to be fully supported.
I reproduced the spurious staged files issue just now:
I have a repo with a number of work trees checked out.
I added one of those work trees to Desktop. The work tree has two untracked files as the only pending unstaged change.
I add that worktree directory to Desktop. It shows the two unstaged files as the list of changed files (which is correct)
I did a fetch and then a Pull rebase.
After the pull the repo has a number of staged files that were not changed and are not the result of a merge conflict (meaning those files were neither modified locally nor staged by me).
Where on the product roadmap does this sit? This would greatly improve the workflow for our team!
Reacted by Jorge Alejandro Elizondo Levy, Roman Kavinskyi, Yarden zamir, Mayukha Vadari, kstraszewski, Dan Smith, paulknisely, Jamie Lammas, Emily Rtshiladze, Takis Katsanos and 14 more
One way you can use github workflow is by having the bare project.
Github workflow adding the branches in the folder.
Opening each folder separately as a repo in the github desktop application.
Each one of them will have same name so just give them alias to identify the branch.
I feel that this feature is more of a editor feature rather then github client because at the end of the day you will need to open that folder in the text editor. vscode and nvim has plugins for it but xcode 👎🏿
In case you are willing to switch to a fork, this has already been implemented in GitHub Desktop Plus. It includes a worktree selector next to the branch selector, allowing you to view and switch between all your git worktrees within the same repository.
Reacted by Ricky Boyce, Lea Verou, Joel, Luis Rueda and Javier Alvarez
Reacted by Ricky Boyce, Jeon Suyeol, Ignat Remizov and Joel
Hey folks watching this almost 10 year old issue! I'm excited to say that we've added support for Git worktrees into GitHub Desktop (built on top of @devxoul work) and that it's currently shipped to our beta channel. If you have time we'd really appreciate it if you could try it out and let us know what you think. We're hoping to release this to our production channel later this month.
Given that this is now on beta and (barring any major feedback) is on its way to being released to production I'm gonna call this issue completed. If you have feedback please open a new issue for us to look at. Thanks!
Reacted by m-harisawa, Jan Potoms, Mayukha Vadari, Jeon Suyeol and Imtiyaz
Reacted by m-harisawa, Mayukha Vadari, BOB, Jeon Suyeol, Leeroy Brun, Samuel Whitby, Mark Adamson, Liviu Macovei and Imtiyaz
Reacted by m-harisawa, Mayukha Vadari, Jeon Suyeol and Imtiyaz
Reacted by m-harisawa, Mayukha Vadari, Imtiyaz and Rajdeep Mandrekar
@sandstrom Interesting, currently the add worktree dialog lets you pick a base path and that will persist across multiple worktrees exactly like how the create repository dialog works (so it is shared across repositories). Would you mind opening a new issue for this so that we don't have to add to this issue?
Activity
elan commentedon Sep 20, 2017
This would be awesome; the only GUI git app I know which handles this right now is Tower.app.
JESii commentedon Nov 13, 2017
I'm sorry... what is the Ask here? Seems like this is just a description of what already happens...
shana commentedon Nov 13, 2017
@JESii This is a description of what git does, to help guide the support for it in GitHub Desktop (which doesn't handle this out of the box)
elan commentedon Nov 13, 2017
@JESii ~ I swear I tried it before and it didn't work, but you're right, I was able to open a worktree directory inside the app and it seemed to work perfectly (commit & push both worked fine). The one tweak which would be awesome is displaying the worktree as part of the sidebar, since right now worktree and parent look identical.
JESii commentedon Nov 16, 2017
Got it, @shana; thanks!
shivakumargarag commentedon Jun 23, 2022
What I understand from the discussion here is that Github Desktop does not support Worktree feature yet and it is being worked upon?
ekimbernow commentedon Jun 23, 2022
At least when I last tested it, if you add a repo or worktree directory to GitHub desktop and maybe perform some other action, not sure, it will create spurious and incorrect staging records for other worktrees in the same repository.
I haven't had the direction from my management to actually look into the code to see what's going on but if feels like a simple bug where something is making a bad assumption or something.
So while GitHub Desktop recognizes worktree directories just fine, there is a bad bug with how it handles repositories that use work trees.
ekimbernow commentedon Jun 23, 2022
For the ServiceNow platform documentation we use git repositories that manage multiple versions of the platform documentation on different branches, where we have at least four versions under active support and development. These repositories are very large (10s of GB of history, ~6GB of working data on any version's branch).
Our authors have a long-standing practice of cloning each version's branch into a separate directory, but today they make a separate clone (we currently use Eclipse as the git GUI for authors and JGit does not recognize work trees at all).
Work trees would be the ideal solution to this crazy work practice (it was put in place years ago) and we very much want to replace Eclipse with GitHub Desktop as our supported GUI solution for ServiceNow writers. Support for worktree is not a must-have--authors can continue to make separate clones as they do today and it will work just fine--but we would really like work trees to be fully supported.
ekimbernow commentedon Jun 23, 2022
Another twiddle is that following a fetch the UI reports the origin as "Never fetched" rather than having just been fetched.
ekimbernow commentedon Jun 23, 2022
I reproduced the spurious staged files issue just now:
I have a repo with a number of work trees checked out.
I added one of those work trees to Desktop. The work tree has two untracked files as the only pending unstaged change.
I add that worktree directory to Desktop. It shows the two unstaged files as the list of changed files (which is correct)
I did a fetch and then a Pull rebase.
After the pull the repo has a number of staged files that were not changed and are not the result of a merge conflict (meaning those files were neither modified locally nor staged by me).
This was with 3.0.0.
I'll try to reproduce with 3.0.2
shivakumargarag commentedon Jun 23, 2022
Great! thanks for the update
nikitaame commentedon Jun 2, 2023
Where on the product roadmap does this sit? This would greatly improve the workflow for our team!
localota-travel commentedon Oct 6, 2023
I came from Perforce and really miss having my branches in different folders. It would be great if Github Desktop supported this.
ShivamRawat0l commentedon Jan 21, 2024
One way you can use github workflow is by having the bare project.
Github workflow adding the branches in the folder.
Opening each folder separately as a repo in the github desktop application.
Each one of them will have same name so just give them alias to identify the branch.
I feel that this feature is more of a editor feature rather then github client because at the end of the day you will need to open that folder in the text editor. vscode and nvim has plugins for it but xcode 👎🏿
30 remaining items
guplem commentedon Mar 15, 2026
In case you are willing to switch to a fork, this has already been implemented in GitHub Desktop Plus. It includes a worktree selector next to the branch selector, allowing you to view and switch between all your git worktrees within the same repository.
boycce commentedon Mar 25, 2026
@guplem thank-you!!! Works amazing.
devxoul commentedon Mar 25, 2026
Yeah I built it on GitHub Desktop Plus and I'm totally migrated to it.
niik commentedon Jun 12, 2026
Hey folks watching this almost 10 year old issue! I'm excited to say that we've added support for Git worktrees into GitHub Desktop (built on top of @devxoul work) and that it's currently shipped to our beta channel. If you have time we'd really appreciate it if you could try it out and let us know what you think. We're hoping to release this to our production channel later this month.
Given that this is now on beta and (barring any major feedback) is on its way to being released to production I'm gonna call this issue completed. If you have feedback please open a new issue for us to look at. Thanks!
sandstrom commentedon Jun 12, 2026
@niik Awesome! 🇸🇪
Is there any chance you'll let us configure where they are stored?
Using worktrunk currently, and it has good support for configuration.
Example
Centralized worktree directory (
~/code/worktrees/myproject/feature-auth):Friendly name (
~/code/worktrees/myproject/malleable-opah):):https://worktrunk.dev/config/#worktree-path-template
niik commentedon Jun 12, 2026
@sandstrom Interesting, currently the add worktree dialog lets you pick a base path and that will persist across multiple worktrees exactly like how the create repository dialog works (so it is shared across repositories). Would you mind opening a new issue for this so that we don't have to add to this issue?
sandstrom commentedon Jun 12, 2026
@niik Added one here: #22308