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
Git: Preserve open files list when switching branches #35307
Comments
any updates on ths? |
Could this be done on the extension level? |
Is anyone working on this ? |
I was wondering the same thing as I noticed that IntelliJ IDEA CE has that feature. I found it really useful. For now, I have to copy the relative path of every file to keep a list of opened files and then close the files. I then switch branches and then re-open files by searching for each of them. I have also tried the workspaces feature to see if it saved the opened files, but alas it didn't. |
This feature would be AMAZING |
I have been hoping for a feature/extension that would do this for months now. It would be great as I jump around a lot and have lots of files. I thought Workspaces was the answer but it doesn't seem to function that way. |
I recently switched from IntelliJ to VSCode and this has become a big problem and will likely cause me to need to switch back. It's a shame, I'd really like to have this feature added as I'm definitely enjoying VSCode but at my job, we switch branches far too often to keep opening/closing tabs so much. :( |
This is the feature I want most to be added to VS code |
This is something I'd really like too. I'd like to try my hand at implementing this feature. I have some questions for someone who knows the codebase better than I do.
|
Any news? At all? |
The Restore Editors extension helps with this issue a lot. |
@romines That doesnt help too much. It has to be automatic not manual. |
I would love to see this! Switching projects is very annoying. |
Any news? |
The only thing I am really missing in VS Code! |
This would be A+. In |
Dear feature, we still miss you 🕯️ |
There may be a hard dependency on #15178 for this to be fully realized - I've done some research to try to unblock it but it'll definitely require some expansion of the extension API to be able to use internal services that describe the Groups of open editors. If this can be polled and modified reliably (and if we can open files into specific Groups), and Git can be polled as well, it could allow for some really interesting workflows! |
Check out this package: https://marketplace.visualstudio.com/items?itemName=eamodio.restore-editors I found it very useful |
Just found https://github.com/gkotas/vscode-restore-git-branch-tabs as well. Haven't taken it for a full spin yet, but this seems to be the right idea. |
Here's the link to the extension |
As a user from PHPStorm forced to use VSCode for remote development, this is a major pain |
I always remember this thread when I change my branches. It is essential functionality! In 5 days it will be 6 years of this issue. How will we celebrate it? |
Definitely a feature that is sorely needed. |
+1 |
any update? |
Related on Stack Overflow:
Related on r/vscode: |
@starball5, you asked on StOv to avoid noisy comments like “+1/bump”. If I understand correctly, the bot here will close the issue as inactive if people will stop to make a noise here. The issue must live :) |
@dreit-p If it's received enough thumbs up reactions to be added to the backlog (which it has), it does not get closed as inactive. Also, please please read https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions. This is not my personal advice. This is an official request from the maintainers of VS Code. |
When working with different branches this would be indeed very useful. |
I really don't know what @joaomoreno meant when he wrote that in #15824 and I couldn't ask there, because he closed the issue. |
Me neither. 😆 This issue is tracking this work. |
A different approach to this problem using Git worktreesIf you don't know what Git worktrees are, do check, because they're very useful. So until we actually see this VSCode feature implemented without resolving to addons, I started using Git worktrees which IMO is even better than this feature could ever be. When I have to switch branch for some other work and not to loose whatever I've been doing in VSCode I now do this:
This way both VSCode windows keep their separate set of open editors not interfering with my work. When I'm done working on the other more urgent branch I will simply close the related VSCode window and maybe keep the worktree for later use with some other branch (hence suffixing it with temp so can be used with any branch) or simply remove it using command |
This would be a very cool feature :) |
See this: #35307 (comment) |
IMO this workaround is even better than out of the box VSCode feature (if implemented). Why? Because without using worktrees, one would still need to use stashing or temporary commits (to be reset upon return to this branch), because that would be Git limitation when switching branches. Of course VSCode could do it for you, but I doubt that would be part of the feature, because one may have some files as changes and others staged (may be the same file actually) and that would be way to complicated to implement so that workspace branch restore would get you to the exact same state. So after using worktrees approach I'm certain even if this VSCode feature ever comes out, I likely won't use it, because of the reasons stated above. I'm sold on the worktrees approach. And I'd urge everyone missing this VSCode feature to start using worktrees. |
@litera I appreciate that your opinion is that worktrees are a better way of going about this than the way that another IDE might. However, coming from another IDE to Code, it is absolutely jarring that this feature is missing from the built-in workflow. Those of us coming from JetBrains products (not by choice, mind you, but by requirement of our employers) to Code are absolutely aware of the limitations of the originally proposed solution - we've dealt with it in our other IDE regularly and it's not at all a surprise when we need to commit or stash changes before switching branches. The IDE makes this painless for the developer. Proposing that people delve into their terminals for something that could be built into the interface seems like, as you said, a workaround, and, I would add, a "hacky" one at that. I will try using git worktrees in my workflow for now, and will wait (hopefully not another ~7 years) for this feature to be implemented in Code. Let me be clear: I appreciate that you've stated your opinion. I appreciate all of the hard work that goes into making an editor such as Code. I appreciate that there are workarounds available. I am only actually upset that I can't use my IDE of choice at my place of employment and wish for all software, Code included, to improve over time. Given a proper settings flag to enable or disable this feature so that all parties could use it or not at their whim would, I believe, be a great win for all developers using Code. |
You do realise there are a few addons for VSCode that have certain capabilities within VSCode you're looking for? So that you don't have to use terminal. But even regarding the terminal. You're correct. You do need to use the terminal or shell or whatever you please. But that's only actually needed when you create a worktree. If you decide to use it longtime, you can then do it all in VSCode. Open the directory of the worktree in VSCode, checkout branches, pull, push, commit... No need for the terminal any more after a worktree is created and running. |
Indeed, I do realize that as I've read the discussion up to now. Why not have an official extension for performing such operations? Why not have an official extension that changes files based on the branch? This is precisely what JetBrains have done, and it works fabulously - I suggest you try their IDE for your language if you never have before.
I'm not going to go into details here or talk about workflows with worktrees, except to say that in my limited experience with them and my major experience with a branch based file changing workflow (as the feature requested in this ticket), the second way is superior. This is my opinion. You have expressed yours. Your opinion that the workflow with worktrees is superior is that - your opinion. Others want the option to have a different way. That is all I will say more on this subject. Thank you for your input. |
Today's VS Code Insiders release (version details below) contains the first iteration of the ability to associate editor working sets (editors, layout) with a source control branch. You can enable this feature using Please enable the feature, try it out, and let us know your feedback. Thank you!
|
I suggest for saving file opening status each git branches. I think the each branches need different files on the branches. If I changed branches and close and open files every time. Next time if I changed branch again, next process is closing opening files and opening files needed to edit. And next time...
The text was updated successfully, but these errors were encountered: