Exclude .git directory from grep search

While searching for text patterns in a git repository, it will show result from .git directory also. It is not a required behavior normally. To workaround that we can use –exclude-dir option of grep command.

For example:

grep –exclude-dir=\.git -rn “foo” .

Above command will not search under .git directory. You can give a pattern here to include more directories if you want.

Switch line endings between Unix/Linux, Windows and Mac OS in NetBeans

By default there is no option in NetBeans to switch line endings between different platforms like Unix/Linux, Windows and Mac OS.

You can achieve this by installing a plugin called ‘Show and change line endings’. It will show line ending of currently opened file and allow to switch on the fly.

It can be installed either directly enabling the plugin within NetBeans. To do so, click Tools->Plugins menu item and open  ‘Available Plugins’ tab and serach it by name. Check the checkbox and press ‘Install’.

Or you may download it and install it.