Thursday, April 9, 2015

Changing Version Control in IntelliJ

IntelliJ supports different types of version controlling methods. I recently had an issue of changing the version control for a project in IntelliJ. IntelliJ was showing an SVN version control, but it was not picking up the GIT version control even if all the git files were there. The solution was to edit the ".idea/vcs.xml" file.

The content was as follows.
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
    <component name="VcsDirectoryMappings">
        <mapping directory="$PROJECT_DIR$" vcs="svn" />
    </component>
</project>
I modified it to the following.
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
    <component name="VcsDirectoryMappings">
        <mapping directory="$PROJECT_DIR$" vcs="Git" />
    </component>
</project>
Then I reopened the project in IntelliJ and was able to see the GIT sub menu in the VCS menu.

The content in the vcs.xml file might be different depending on the project.

Recently one of my colleagues was having the same issue. In his vcs.xml file, There were several mappings all directed to "svn". We changed to "Git" and reopened the project. An error notification started appearing at the top right corner mentioning a version control error and there was a link as "configuration". Once clicking the link it showed the "Version Control" of the project. We removed the broken mappings and added a new mapping with GIT. We checked the vcs.xml file afterwards, it was as following.
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
    <component name="VcsDirectoryMappings">
        <mapping directory="" vcs="Git" />
    </component>
</project>
The Git menu also came up in the VCS menu in IntelliJ.

Please note that I haven't tested with other version control methods in IntelliJ. This is just sharing hick-ups I had during coding. :)

Sunday, April 5, 2015

Open Sublime in Terminal for Mac OSX

Even though we install Sublime 2 or 3 using a DMG file in Mac OSX, we cannot open Sublime using the terminal. To fix this, run the following...

For Sublime Text 2

cd /usr/local/bin
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" subl

For Sublime Text 3

cd /usr/local/bin
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" subl

To open Sublime in terminal, use the following command.

subl 
To see usages of subl command

subl --help

References

  • https://www.sublimetext.com/docs/3/osx_command_line.html
  • http://stackoverflow.com/questions/11889484/command-subl-from-terminal-dont-work
  • https://bensmann.no/open-folder-in-sublime/