Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Improving Git command access in IntelliJ

DZone's Guide to

Improving Git command access in IntelliJ

· Integration Zone
Free Resource

Modernize your application architectures with microservices and APIs with best practices from this free virtual summit series. Brought to you in partnership with CA Technologies.

It's been over a year now since I switched from Eclipse to IntelliJ. Every day I enjoy the simplicity and power this IDE brings to me.

In this short article I'll show you how you can improve your IntelliJ experience when using IntelliJ with Git source code management. First of all IntelliJ comes with Git integration out of the box. So there's no plugin installation needed. Unfortunately some of the most commonly used Git commands like Merge and Pull are located deep inside the VCS menu hierarchy. And there is no shortcut predefined which makes it even a little bit more annoying. In order to speed up access to the Git commands you need frequently open the Settings dialog (CTRL + ALT + S) and navigate to "Quick Lists". Add a new list by clicking on the green plus sign. Give it a significant name, e.g. "Git". Now click the green plus button on the right side of the dialog to add the commands you would like to access via this quick list. In the new dialog navigate to Main menu - VCS - Git and select the command you would like to add, e.g. Pull. Repeat this step for other menu commands you use frequently. If you're done hit the Apply button to save your new quick list.

Now you need to configure a shortcut to access the quick list. In the IDE settings area on the left side choose "Keymap". Open the Quick Lists folder on the right and select your quick list. Press the right mouse button on the quick list to bring up the context menu and select "Add Keyboard Shortcut". Choose a shortcut you like, IntelliJ will warn you if it is in use already. Hit OK to confirm your selection. Close the settings dialog.

Now if you press the keyboard shortcut your quick list will show up and you are able to access your Git commands almost instantly.

One more thing. Sometimes you may want to execute a more sophisticated Git command like

1. git log --graph --oneline --decorate HEAD MERGE_HEAD

If you have the latest version of IntelliJ Ultimate you don't need to switch to a command line window. You can execute the command in IntelliJ's new Terminal view. Open the settings dialog again and choose Terminal. In the "Shell path" text field enter the path to your Git installation, e.g.

1. "C:\Program Files (x86)\Git\bin\sh.exe" --login -i

in case you are using Windows. Now if you activate the Terminal (Alt + F12) you are able to execute your Git commands inside your IDE without switching windows. Great?! As JetBrains would say: Develop with pleasure!

The Integration Zone is proudly sponsored by CA Technologies. Learn from expert microservices and API presentations at the Modernizing Application Architectures Virtual Summit Series.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}