IntelliJ: Lost files after "Update project" and can't find them on Local history - node.js

I have a nodjs project and i use IntelliJ to run it. Lately the project structure is not appearing as it used to, as if the project was not compiling. So, while searching for answeres, I clicked on the "Update project" button on the right top, but quickly realised it was going to update based on what was on the remote repo.
I've been developing for a few weeks without a single commit because my company asked me to (don't ask why), and the code had sensible data so I didn't have a backup.
After clicking that button, IntelliJ asked me if I wanted to merge my project files with the remote ones, I just pressed Cancel, and that was enough for IntelliJ to merge my entire project and lose a bunch of files I've been working with.
Suprisingly, they're not even on the Local History list. Even though it says "279 files" there I can't click or find any of the files.
Despite not being able to find them, I went to the changes.storageData file under IntelliJIdea2017.2\system\LocalHistory, searched for the names of the files I'm looking for, and found them all there, which makes me think there's still a way of finding them.
So, does anyone know where I can find deleted files after pressing the git "Update project" button on IntelliJ when they're not on the Local History file list?
Thanks a lot in advance!

As I understand, the files were not committed, so Update could not delete them, because git merge/rebase do not start when there are uncommitted changes (see e.g. this question)
They were probably automatically stashed before the update, and not unstashed because the update was actually canceled.
So the first place to check is git stash VCS - Git - Unstash... or Shelf (if Update project is configured to use Shelf)

Related

Open uncommited files in Android studio

I have been working on several java and xml files in android studio.
Now when done, i want to open the all modified files all at once to review them before a commit.
Something similar to git status and then git show for each and every one of them.
I can do it manually of course but i was wondering is there a better way to do that.
I think you are looking for the Local Changes part of the Version Control tab (Alt+9). There you can check the changes, though you need to open them one-by-one.
If you open (Ctrl+K) the Commit dialog, you can also check the diffs easily within the window, I find that very useful:

Undo checkin in TFS using visual studio 2012: rollback will not give me my pending changes back

I accidentally pressed the Checkin button when I had a list of all my pending changes (in several solutions) open (and I had disabled the confirmation prompt a few years ago, have restored it now though).
I know I can do a rollback of the specific changeset, but this will not give me back my checked out items as it will just overwrite the changes of the changeset with new changes.
Does anybody know of a way to undo the checkin and get my checked out items and changes back?
Perhaps there is an extension to do a rollback, keep al the changes locally and check out those files again.
Or there is another automated way to keep al the changes and check out the files (manually checking out each file is to much work).
Edit
There doesn't seem to be a perfect way. For me the best solution was to 'Rollback the rollback'as stated in https://stackoverflow.com/a/24896432/1343595

How to show gutter for git diff?

In IntelliJ there is a gutter to the left of the text editing area that can show git diffs. I would like to have the same thing in android studio. Is there a way to make this appear?
I've run into this issue a couple times using Android Studio there are two reasons I've seen Git diffs not show in the gutter.
The Git VCS path for the project isn't set. You can typically set this in your project by going to:
System Preferences > VCS
Then hitting the + button and adding your Git root directory.
The project xml is borked. Sometimes a corruption exists some where in the code directory. Unfortunately, after hours of searching through XML in the .idea directory and other files and directories I was never able to find the culprit. However, simply deleting the project, pulling it down from source control and re-importing it into Android Studio re-enabled the git diffing in the sidebar.
If you already have the git-repository associated with project. And you just need to enable VCS, to be able to perform operations (pull, push, etc.). You need to select : VCS >> enable VCS. Then after, it is automatically able to understand the source-control associated with the project. You can validate, by selecting : VCS >> Git >> Branches.
NOTE : I had been using git for version-controling, hence it shows "Git" option in the VCS menu list. This may differ based on your tool.

How to open the actual file from changeset details in Visual Studio 2012, and not some hashed read-only server copy?

This is the first time I've tried this in a VS, much less VS 2012, so if the answer is common knowledge, I guess I'm just not that common. (Yeap, Google failed me as well --- or my Google-fu just needs some oiling.)
I'm looking through my TFS code repo history, and from the list of changesets, I opt to view changeset details. Up on the VS 2012 right sidebar, I get a list of all changed files for this particular changeset.
However, I want to open up one of these files and modify them directly (basically for purposes of light code review and housekeeping), so I right-click on one, and select Open.
Unfortunately, this doesn't open up my local copy of the file, but instead (seemingly) downloads the file from the server and gives me the server copy, with a modified filename (suffixed with a short hash). I can't modify this at all.
Is there a way to open my local file copy from the changeset details?
What you could do is right click the file.
Then choose open in source control explorer.
Double click the file there.
Bob should be your uncle now.
If you right click and compare it to your workspace version, that will open a diff between the workspace version and the changeset version. I don't believe there is a way to open the local version of the changeset file directly, as that version doesn't really exist in your local workspace. What you are opening when you open it from the changeset is the specific version associated with that changeset. The file may not even exist in the current solution, so opening the workspace version in same cases wouldn't even be feasible (or you may have never gotten the file).
To the best of my knowledge there is no good way to do this (I wish there was). It's a bit time consuming, but you can get the same effect with a bit of manual effort:
Open the changeset, rollback changes, go to pending changes, and open all of the files. After the last file has opened, go back to pending changes and undo changes (i.e. your rollback). All of the files from that changeset should now be current and open in visual studio.

TortoiseSVN: how do I undo the last Update command?

The last TortoiseSVN Update command loaded work-in-progress code from the trunk which shouldn't have been committed yet, and overwrote the files that I had on my branch.
How do I undo that last Update command and revert back to the versions that I had on my machine before the Update?
There is no "undo" or "revert", but if you update to the previous revision, that is the recommended way to accomplish what you are asking for. In TortoiseSVN, select "Update to revision..." and enter the revision number you want to go back to.
revert back to the versions that I had on my machine
If you had local changes on your machine that were never committed (i.e., no revision number), and you updated over them, then you are out of luck. The only way to get back your local changes is if you have a backup (check the "Previous Versions" tab in Windows Explorer...)
Check out this guide for undoing revisions on TortoiseSVN. The entire concept of version control supports the issue you've created for yourself so it is a popular action.
This is called update to revision... In the ui you can choose which version you want to go back to. Make backup copy of your local svn tree first to be safe!
You can update to a specific revision by right clicking on your working copy, Under the TortoiseSVN menu item, there is a update to revision menu option that will allow you to change your working copy to the revision of your choice. If you do a show log on the repository you can get an idea of when the offending code got committed and revert back to the prior repository revision. As a precaution, I would make a copy of and working copy, or important files in your working copy, to ensure that if things go bad, you can always get back to where you are now.
Now this changes your working copy, not the repo, so if you are wanting to revert the repository back, then that is a different issue, but I do not think that is what you are asking for.

Resources