-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Add support for local history #26339
Comments
That would be amazing. Jetbrains has probably the best local history support. There are a couple of extensions for VS Code but they aren't as convenient. |
please add this option please
single programers we don t need all the git complexity. |
+1 (just few mins ago, wanna discard some changes in just few files... discarded all unstaged files...) |
Can anyone please suggest - "How can I see my local file history changes in VS code like we can check in eclipse IDE? Sometimes we do changes a lot in single file before commit and this feature can be really handy to check entire day's changes in one file. I have checked few plugins like "Local History" but the changed files keep on adding in my git changes section and changed file numbers keep on increasing. I doubt if I am using it correctly. Please suggest best plugin or options for it. Thanks |
For reference, there is an extension, but it's not nearly as powerful as what's offered in IntelliJ/WebStorm. Examples of features that I'd like to see if this were to be implemented:
This feature set also has synergy with #43555, #52844, and #9390. |
This is something that would be super helpful. even just to be able to save undo across sessions would be amazing. |
Here's a horror story. I had all my files tracked in Git and began writing code for a new feature that used an API at the end of a file, so my workspace had uncommited changes. Because I had to wait for approval for more API quota to continue developing and testing my code and because my code wasn't yet commit worthy, I continued work on other projects and forgot I had uncommited changes in that repository. A few days later I was experimenting with some VS Code features and I needed to purposefully create some linting errors in a file to test it out, so I opened that same repository and randomly deleted a few lines at the top of the file I had been working on a few days before. I mistakenly thought I could just "discard changes" in the Source Control tab and Git would bring my file back, reinserting the lines I deleted. I closed the file, losing the ability to undo (cmd+z) the deleted lines. As I was ready to reverse the deleted lines, I hopped onto the Source Control tab and only seeing the deleted lines at the top of the file (I did not look at the Ruler on the right hand side to see I had more uncommited changes), I pressed "Discard Changes". A few days later my request for API quota was approved and I reopened the file. As I scrolled to the end of the file my jaw dropped and I started replaying this cute little story in my head, trying to understand out how the hell had I figured out a way to permanently delete my own work. TL;DR I would love an ETA on this feature and a comment on what's blocking it from being shipped. |
I would love this feature! 😍 |
+1 |
This feature is useful |
Any update about this feature |
+1 |
Today i stopped using VS Code after 4 years and switched to IntelliJ. THIS IS THE REASON WHY. I love VS Code, but a editor without local history is gabrage. |
VS code should add this feature ASAP otherwise sooner or later, developers find other IDE to work Because we all do mistakes and high chances of losing our work in the absence of this feature. |
Team Explorer does let you view history for any changed files, but I don't see how to use it for a file that hasn't been changed... |
Great news, thanks for that! Just a curiosity: what's the filesystem location of the files that are created to keep that history? And, is there a way to keep it clean at some point (either manually or automatically)? |
I wanted to learn how to build that :( |
@antariksh17 sorry for that. this was a rather involved change, but I am happy to answer any questions that you might have for how I added this via #145136. Typically I would try to look for issues that have the related label applied for where we ask for help, please see https://github.com/microsoft/vscode/wiki/How-to-Contribute#where-to-contribute
That depends on how VSCode is run:
When stored in the file system, there is a folder called As for cleaning up:
Not sure you are missing another way of cleaning up entries?
Please cast your vote at #25887 |
@bpasero Thank you very much for your excellent work. I made a feature request here I have two more requests, but I could not open a new ticket (github gave me error 500!), so I will post them here: Timeline - lists all the files which are saved in the backup folder Timeline - track renamed files thank you. |
The command "Local History: Find Entry to Restore" gives you a list of every file that has local history entries. From there you can drill into the individual entry. If you have the "Timeline" view visible, you can delete individual entries. I know this is a bit rough from a UX point of view and I think #95332 needs to land in order for the timeline view to show the full set of all local history entries. I am open for suggestions how to improve the "Find Entry to Restore" picker. It would be easy to add a button into the picker to remove entries from the picker.
Yeah, that is on my list to look into, if I cannot get to it, I will file an issue for it. |
cool, I did not know that this option keeps track of deleted/renamed files too, nice.
yes a button to remove an entry will be useful, or maybe a button to open the folder where the backup of a specific file resides, which will serve for other purposes (like deleting the content or do a grep search), because actually the folders names inside History folder use a hash, and it is impossible to decrypt that hash because of the Bitwise left shift used I think. |
Yeah, so the location of a history entry is actually a hash of the full original path so that we have a fixed-length unique location for each file. Within the location, each entry is a random 4-length name with the original extension. As a sibling there is a {
"version":1,
"resource":"file:/Users/bpasero/Desktop/project/file.ts",
"entries":[
{
"id":"4oXJ.json",
"timestamp":1647520366982
},
{
"id":"DEnq.json",
"timestamp":1647523809834
},
...
]
} Feel free to file individual issues for the things you ask for, then we can proceed in those issues and discuss them there. |
We will ship this feature as part of our April release next week. You can use our insiders builds to benefit from the feature today: https://code.visualstudio.com/insiders/ The test plan item #145461 covers its capabilities, so feel free to give it some testing and report issues back. Some new things added over the past days:
Existing issues are labeled timeline-local-history |
If anyone has a better idea for how to call the The way it works is:
Some suggestions so far from the team are to call it |
|
Yeah that site is really helpful, I use it a lot. I think |
I vote for |
Another idea I had was Though |
I vote for the word merge too. how about |
@badrelmers the setting itself is a |
yes. then why not |
A few more suggestions:
|
It seems to be impossible to go back to the old behaviour, which is to have a single timeline item called "uncommitted changes". This makes it very hard for me to see what I have changed since the last pull, without painstakingly going through each individual timeline item and memorising the full diff between each version. Storing local history is very useful, but could we have a switch to easily toggle between showing:
Turning off the new local history feature in workspace settings seems to show just the git timeline without any information about uncommitted changes. |
Uncommitted changes are accessible from the SCM changes view: The decision to remove the entry from timeline was discussed in #145723 |
This should be something you can toggle between. And if you turn off local history then it should definitely still be shown. |
I did not test the proposal, but it would be useful to tag history entries in relation to SCM. If the latest committed state was flagged, that would facilitate the use case of @jacrosby (as long as that entry is still in history...) |
There is currently no relation between SCM entries and history entries, they are 2 independent providers of timeline entries. |
I want to thank everyone involved so much for this feature. |
I would love to be able to see my local history for a file like you can do in intelliJ.
The text was updated successfully, but these errors were encountered: