Recover deleted file from PhpStorm and SourceTree - phpstorm

I have an open project in PhpStorm that I manage using SourceTree. I was trying to remove some image files from a commit using SourceTree, but accidentally selected a file that should not be deleted. I haven't changed anything (in either PhpStorm or SourceTree) since deleting the file. I tried to do Ctrl+Z in SourceTree but nothing happened. I then checked in PhpStorm Vcs -> local history, but it didn't show the file. How can I recover this file?

Try to right click on project main folder in phpStorm and select Local history / Show History in context menu (not vcs / local history). The file should be at the list as "Deleting".

This is documented by JetBrains here
TL;DR

Related

How to set highlighting of directories with added files to red/blue

I'm using PhpStorm 8.0.3 (on Windows, MacOs and Linux). I'm using GIT in my project. My remote server is through SSHFS.
I know option "Show directories with changed descendants". I've marked it. But when I'm adding new files (they are marked on red in project tree view), parents of these directories are not highlighted/marked (such directories have normal, white color). How can I change it?
Thanks.
Please vote for IDEA-138890 to be notified on any updates

file deleting in nitrous.IO

I am playing with a repo I've cloned in nitrous.IO.
I mistakenly created a "README_UPDATE" file without the .md extension when I was planning to push my commit to github. I've tried to 'rm README_UPDATE' with no success in the command prompt; and right click file delete is not working in either nitrous.io on the web IDE or their google app extension.
I've also tried 'ls' to make sure I was in the right directory just in case anyone is asking.
I don't want to delete all my work, so is their any other options for me?
Have you tried right clicking the file and selecting 'rename'?

How to disable version control in phpstorm?

I am playing around with phpstorm and somehow I activated version control. I don't need it. Now all my tabs are different: orange text on gray background. All files in the file view are orange. How do I disable version control?
Go to Settings -> Version Control and remove the folder from which you would like to remove version control tracking (coloring tabs etc.) It will naturally not remove version control from your project (as in deleting the .git/ folder for instance).
The ultimate way is to disable all version control plugins (under Settings -> Plugins): CVS Integration, Git Integration, GitHub, hg4idea, Perforce Integration, Subversion Integration. After restarting PhpStorm Settings -> Version Control tab will be gone.
Note that this will disable version control for all of your projects.
You can just remove vcs.xml from .idea folder and then restart PhpStorm
In phpStorm 2022.1.3+, go to
Preferences > Version Control > Directory Mappings
Then remove the directories you don't want to watch, as Greg suggested.
Go to Settings -> Version Control and remove the folder from which you would liek to remove version control.
I have not enough reputation to +1 Greg's answer or comment, but... for those who are interrested : the same goes for Webstorm.
I had this problem and I used from 2 of notes in these answers in these page together.
As Greg has mentioned in one of replies, your git repository is in .git sub directory inside directory that you want to manage it with version control system. When you define a git repository, PhpStorm automatically generate it and with creating this sub directory, it adds a file for handling mapping between itself and version control system. It calls vcs.xml and it's located in .idea sub directory.
It's not enough to remove only .git directory. When you remove .git, you will get an error in PhpStorm every time that you open your project due to not matching vcs.xml for mapping between PhpStorm and git repository of your project. So after removing .git directory, you must also remove vcs.xml files from .idea and now you won't have any error or warning in your PhpStorm.
It doesn't need to restart PhpStorm at all and after this, colors of all of files that was mentioned in questions return to normal colors in PhpStorm.

My intellij java project can't find misc.xml

I have a java project in Intellij and use Hg/Mercurial for version control. I ignored some files with this .hgignore file
syntax: glob
target/*
.idea/*
*.iml
and deleted all these files which was committed before. but now I can't execute my project, cause it can not find the file misc.xml.
What should I do?
Updated answer for IntelliJ 14+: File-> New-> Project from Existing Sources... (choose your project directory) and follow the wizard Q&A.
Restarting Intellij should fix the problem. Just make sure you click on the "Import Project" pop-up that appears on the top right.
At first, you shouldn't really ignore everything under .idea but instead only .idea/workspace.xml and .idea/tasks.xml, as it JetBrains states: http://devnet.jetbrains.com/docs/DOC-1186
To solve your problem and get your project back to working state there are possibly two solutions:
Checkout the last commit that contains the files under .idea folder with
hg checkout SHA,
where SHA is the commit id.
After that reset your working space to the head:
hg reset HEAD
Edit your .hgignore in the way that was recommended before, add project files to stage, and commit them:
hg commit -am "Reverted project settings"
If there is no commit with the project settings, you can just import your code back.
Start Intellij IDEA and choose "Import Project". Choose the folder with your code, and choose the appropriate SDK after.
I met this problem when I did rm -rf project command, then when I git clone a new project to my working space, maybe quit the idea and then import the project again. This can easily solve this
I have found that for this error and also for some other cases where the IDE project behavior is inconsistent with command line behavior, the following often helps: close the project's Intellij IDEA window, delete .idea/, and open the project again. IntelliJ often flashes up a message saying it didn't find a project root but generally this disappears after a few seconds and IntelliJ automatically rebuilds the .idea directory.
Recreating the .idea folder
File -> Close project
File -> Open -> Choose pom.xml under the project folder -> Open as project -> Delete existing project and import

TortoiseHG Sync - How to save URL

I've recently migrated to Mercurial for source control and am using TortoiseHG. Everything is working great, but whenever I go to "Synchronize" to do a push, the remote repository URL is blank and I need to type it in every time. How do I save it so that the remote repository source is saved?
You did not mention which version of TortoiseHg, but there are two "standard" ways to save the URL:
1) Manually add the following lines to your <project_dir>\.hg\hgrc file:
[paths]
default = http://server/path/to/remote/repo
2) Click the "Save" icon in TortoiseHg's Sync view: