Ctrl + v and
Cmd + Shift + a shortcuts in PhpStorm. Period.
I changed my job recently, so I changed my coworkers as well. It’s always a good opportunity to learn something new. And a good excuse to write about it 😉
So I want to present to you my favorite shortcuts in PhpStorm. I’m working on a Mac so presented shortcuts are for its keyboard. And I’m using “Default” keymap.
Quick version control operations
If you’re using Git then you can use it in PhpStorm in two ways: console and in version control (VCS) menu. There are also some handy shortcuts, like
Cmd + t for
git pull or
Cmd + k for
git commit. But if you want to create a branch, or checkout to one, you go to VCS menu, find your option and click it.
Waste of time!
I use git for about 3 years. First I knew only how to use it with PhpStorm – `cmd + t` to update branch, `cmd + k` to commit and push changes. To make new branch I used menu and let the IDE do the work. It was fine until I heard about `squash`. I heard that it is often used when you contribute to someone’s repository. Maintainer of the repo often want clean history – if you want to contribute you must make pull requests with only one commit. And you may do it using squash.
It was a bit too much for me at that time: `squash`, `rebase`, `push –force`. No thanks 😉
Some time later a couple of people in my company started to use git more. They started to make squashes, rebases and so on. So if they wanted to use it I had to learn it too.
Lets talk about Git hooks. You’re using Git, right? No? But… you have to! Seriously, go to git-scm, GitHub or whatever and check it out.
In Git you have 3 types of files: tracked, ignored and untracked.
Tracked ones are simple – they’re just files you’ve added to the repository. This might be your application’s code. Ignored ones are also simple – if you don’t want to have any file you can add it to `.gitignore` file and you will have it locally but not in the repository. This might be any vendors you can easily install and don’t need to store them in your repository.
But untracked files are a little bit more complicated. These are files you’ve just created and didn’t specify what to do with them. Are those useful and should be added, or are they just temporary files or vendors? They might be also autogenerated files and this post is really about them.