官术网_书友最值得收藏!

  • PhpStorm Cookbook
  • Mukund Chaudhary Ankur Kumar
  • 495字
  • 2021-08-06 19:43:16

Restoring deleted resources

To err is human. To recover from the error cleanly is PhpStorm. It is perfectly okay for you to commit mistakes. You could be thinking of your ex or your reporting manager's atrocities on you to make you work overtime (while he himself keeps tinkering with social networking sites), and you happen to accidentally delete some lines from your code. You have no idea what you did, and with a heavy heart, you went home at the close of day. The very next morning, when you are about to start work, you suddenly realize that you deleted some lines of code and you don't remember which! Is this something like salt on burnt skin? Need ointment? Breathe and thank PhpStorm's team of developers who knew that you are a human prone to making drastic mistakes like these.

Getting ready

You can recover the lines deleted from your code. Yes, you got that right. There is the history feature in PhpStorm that is one of the best in its class in terms of the visual assistance it provides in finding the change that has occurred to your code—be it local, that is, you were the culprit behind the notorious code change, be it from the team, that is, someone else's code ruined yours. PhpStorm helps you point out the mistake or error and helps you in fixing things quickly.

How to do it...

PhpStorm keeps a snapshot of every code that you write. It updates it every time you save. So, if you need to undelete a piece of code, you need to dive into the history using the times of editing the files as anchors. As soon as you change to another window it automatically saves the document…wasn't that cool. Perform the following steps:

  1. The Local History option is available on the mouse right-click context menu.
  2. As soon as you click on or select a particular time, PhpStorm shows you the difference between that file from history and your current file, as shown in the following screenshot:
    How to do it...
  3. You can revert to (this) particular item by selecting the Revert option from the right-click context menu. Done!
  4. You can also merge the code line by line by double-clicking on the greater-than sign (>>).

How it works...

If you deleted a file from PhpStorm, knowingly or unknowingly, you can use the same feature to recover your deleted files. You need to select the target folder or directory from the Project view, access the right-click context menu, and select the Local History | Show History option. PhpStorm will not only show you all the files that you deleted very easily, but also in a hierarchical way, as shown in the following screenshot:

How it works...

All you need to do is to access the right-click context menu on the file that you want to recover from the list and choose the Revert Selection option. No more cigarettes and coffee combinations, please. Your headache is solved.

主站蜘蛛池模板: 安化县| 阿图什市| 芮城县| 朝阳县| 芦溪县| 英山县| 永登县| 门头沟区| 崇文区| 潜山县| 松滋市| 临澧县| 青神县| 金沙县| 清镇市| 区。| 桦川县| 苏尼特右旗| 金阳县| 当雄县| 云安县| 电白县| 茌平县| 新兴县| 安阳县| 兴城市| 乌什县| 达孜县| 淮滨县| 伊金霍洛旗| 灵寿县| 天峨县| 大连市| 蒲江县| 长岛县| 神农架林区| 东宁县| 巴塘县| 红安县| 同德县| 嘉荫县|