How to highlight the edited file using git in intellij? - intellij-idea

Eclipse will highlight the files that I have made changes in git repository, but looks like intellij don't highlight that. Is there any preference that I can configure ?

Go to Settings -> Version Control then edit your project for setting git root. After that IDEA will show all changes in your files.

Related

Autoupdate Intellij IDEA code style from cloud

We need to have common code style config for all developers at project. How tune Intellij IDEA for auto-update code style config from cloud?
For example: Added codeStyleSettings.xml to git repository. When new changes of codeStyleSettings.xml pulled from repository, updated local config of project code style.
I found answer there - How to share Code Style settings between developers in IntelliJ.
Code Style can be copied to project and saved in .idea/codeStyles. Next needs exclude ignoring this folder in gitignore.

IntelliJ is hiding folder in project window mentioned in .gitignore file, how to show that folder in project window?

ignoring build folder does not show it in project window.
commenting .gradle in .gitignore does show it in project windows.
I want to show both .gradle and build folders in project windows but I also want to include them in .gitignore file.
Right click on a directory in the project view and make sure Hide ignored files option is not enabled.
This feature is provided by a third-party .ignore plug-in. IntelliJ IDEA doesn't hide ignored files out of the box.
Note: If you don't see the .gitignore-d files, then try clicking this option regardless of its label in this menu. Sometimes because of a bug the entry says "hide" but clicking it actually shows the hidden files.
Some updates to .ignore plugin suggested in this answer.
IntelliJ now suggests installing foldable-projectview
This plugin really provides flexible configuration options.

Intellij Annotate Option Grayed Out

I am trying to look at who changed a line in Intellij 15. I know I can use git blame but I want to learn how to do it correctly in intellij. I am right clicking on the line numbers on the file but when I get the context menu the annotate option is grayed out. What setting am I missing?
I looked at this page and couldn't find an answer. What am I missing?
If you check File > Settings > Version Control and see that your current project is listed under "Unregistered Roots", go to (on the menubar) VCS > Enable Version Control Integration. It will ask you to select the VCS tool you use, then click ok and you'll have all the integrations working (including the annotate feature which uses git blame).
The answer by #activedecay let me in the right direction. In my case, I have a multi-module project - each has a separate git repo - but we're all in the same workspace.
In my case, Intellij IDEA 2017.2, the Preferences -> Version Control (update from 2022: or Preferences > Version Control > Directory Mappings) panel shows a listing of all the project roots. The module with the disabled "Annotate" option was in the "Unregistered Roots" section.
To fix the problem, I selected the module and pressed the "+" icon in the lower toolbar to register the module root with Intellij VCS. The change is immediate and the "Annotate" options becomes available.
Looks like its a fresh project. First configure the Version Control like Git and than commit at least once. After first commit Annotate option will not be grayed out.
Also update git for any new version.
Your VCS is not enabled, hence the issue. Below is the solution for that:
Click on the VCS option in the menu bar
Enable VCS
Select your version control
Done, you should be able to use the annotate option.
Make sure the file is tracked by version control
Add the project to "Version Control" settings
I had the same issue with the Annotate being greyed out however VCS was already set up. Editing the current VCS Directory Mapping fixed the issue for me.
Go to
Settings -> Version Control
Click on the current entry for your
your application listed under projects.
Click the pen icon to edit it
Hit Ok, then ok to close the main dialog
Under the version control setting, make sure to remove any unregistered roots, I had a similar issue where there was a Unregistered roots entry was found, after removing this unwanted entry, I was able to annotate on file.
I the following two screen short will solve your problem:
1.
I hope after those steps you will be able to see who changed a line.
Here are the steps i followed :
Go to VCS -> Checkout from Version Control -> Git -> give the URL for your repository.
The annotate option will be enabled now.
I had exactly the same issue and managed to solve it by updating git.
The reason for that is that I have recent InteliJ Idea and an old 2.1.x git installed.
For Mac:
brew upgrade git
brew link git
followed by IDE restart.
Perhaps you did not check Git Integration while setting up a fresh installation of IntelliJ. It happened to me when I updated to a major release. When I was setting up the new program, I might have unchecked the Git Integration on the wizard installation.
In order to solve this for IntelliJ Community 2019.1, access File > Settings > Plugins, go to the tab Installed and make sure the plugin Git Integration is checked. You should restart the IDE in order to make the Annotate action work.
I had the same issue, but my VCS settings were all configured properly. It turns out that git itself was considering the file as a brand new file and therefore didn't have any history for it. The file was actually not new, but simply renamed. While my rename changes were unstaged, git understood it as two separate files: a deletion of the old file and creation of a new file. However, once I git added the "deleted" file and the "new" file, git understood that it was actually a rename and IntelliJ was able to annotate on the file as expected.
I'm not sure why git didn't understand the rename when it was unstaged, but hopefully this helps someone!

IntelliJ IDEA not showing my module/project

Suddenly, IntelliJ IDEA is showing the following module view with a strange yellow colour in the background. I don't know how to get my module back, because it is not being shown:
Do you know how can I see my project folder back?
Thanks
This is way late, but deleting my .idea folder did the trick.
Close IntelliJ
cd <project-path>
rm -rf .idea
You can go to File-> Project Structure and then define it as a Source Folder
In Intellij, Right click on your parent pom file and click add as maven project
For Maven Projects that don't show up you can right click your pom.xml and click 'Add as Maven Project'.
In my case Modules kept on disappearing and I managed to fix it with these simple steps:
In the Project panel, right click to see the context menu
Select "Open Module Settings"
Select the Module that is not shown in the tree view
Select the first tab labeled "Sources"
Press the "+ Add Content Root" link
Select the root folder where the files for this module are located
Once the folder has been scanned, press the OK button and you will see the Module appear
I had a similar issue. Other answers did not solve the problem for me.
I ended up uninstalling IntelliJ, then installing a new copy. When prompted to import previous settings, I selected the option of not to import, then set up IntelliJ from scratch. After re-install/re-setup, I was able to open my project folder and all of the modules showed like before. Some how my IntelliJ got fubared, my guess is that it happened when I updated it last week.
For me, I must've deleted my .iml file somehow. Files with .iml contain configuration for your modules. The problem was that my project module was not being loaded without it. I'm using gradle, syncing my project with gradle regenerated whichever *.iml was necessary to build. Here is a post that provides a succinct explanation.
IntelliJ IDE | .iml File lost or deleted
Also - I know this issue is probably long gone and out of his head but for whoever may come across this issue, the above was the solution for me.
Check if the FACETS panel is blank
If it's blank .Then click the "+" button to add
one.
For me .I need a android facet.
For details.go to this link
Hope this is work for you.
I assume you are used to working with Eclipse. Intellij IDEA uses the same idea, but different names.
A Eclipse workspace is equal to IDEA's project.
A Eclipse project is equal to IDEA's module.

Is there any way for Intellij to bold or highlight directory that has file changes like Eclipse

Is there any way in Packages or Projects pane to highlight or bold directories/path that has local file changes (diff from VCS repository). Eclipse has this.
I know there is a way to get all the changes if I change the pane to Changed files.
Settings -> Version Control -> Show directories with changed descendants.
On new version of IDE, this settings were moved to:
Settings -> Version Control -> Confirmation and enable "Highlight directories that contain modified files in the Project tree"