.gitignore not working

While maintaining Version Control System in your codebase, some may face an issue like .gitignore file is not working i.e., particular file/directory is not ignored even if its present in .gitignore file.

The possible reason for that to happen may be a case that while creating a repo in GIT for the first time and pushing your code to that repo, you would have pushed your complete code and then you might have created the file ‘.gitignore’ and updated it according to your requirements.
If that’s the case then yes, your .gitignore will not work. Its because the files included in .gitignore is already being cached by GIT.

To overcome this issue, follow these steps:

Update .gitignore file according to the requirement.
1. To make a single file to be ignored by GIT:

git rm -r –cached path/to/file
git add .
git commit -m “fixed .gitignore”
git push origin branch_name

2. To make a multiple file/directories to be ignored by GIT:

git rm -r –cached .
git add .
git commit -m “fixed .gitignore”
git push origin branch_name

  • The first line unstages and removes the paths to your files from the git index recursively.
  • The second line adds all your files back in but because the .gitignore is present it will not add files that should be ignored!
  • The final line commits all your files back to the index.

Reference: http://bit.ly/1XVNEHp

Hope this helps!
Enjoy VCS!

Extract files in ubuntu using terminal

  1. Extract tar.gz file:If your filename is backup.tar.gz, enter the following at a command prompt to extract files:

    tar -zxvf backup.tar.gz

    To extract xyz.doc file from backup.tar.gz, enter the following at a command prompt to extract file:

    tar -zxvf backup.tar.gz xyz.doc

    Where,

    1. -z : Work on gzip compression automatically when reading archives.
    2. -x : Extract archives.
    3. -v : Produce verbose output i.e. display progress and extracted file list on screen.
    4. -f : Read the archive from the archive to the specified file. In this example, read backups.tar.gz archive.
  2. Extract .zip file:

    unzip file.zip -d somedir

    to extract to yourpath/somedir

    If you want to extract to a non-relative path, use:

    sudo unzip file.zip -d /somedir

Enjoy coding!

 

Upgrade MySql server 5.5 to 5.6 in ubuntu 14.04

Following steps to be followed when situation demands to upgrade MySql server from 5.5 to 5.6 in ubuntu 14.04:

1. Take a backup of current database
     mysqldump –lock-all-tables -u root -p –all-databases > dump.sql

2. Remove MySql server 5.5
     sudo apt-get remove mysql-server
     sudo apt-get autoremove

3. Install MySql server 5.6
     sudo apt-get install mysql-client-5.6 mysql-client-core-5.6
     sudo apt-get install mysql-server-5.6

4. Restore the database
     mysql -u root -p < dump.sql

If you are using MySql client phpmyadmin, then it may fail to load after the MySql server upgrade. To make it functional, follow the command:
     sudo apt-get –reinstall install phpmyadmin

Reference:
http://do.co/1s6EPyL
http://bit.ly/1TAxXCP
http://bit.ly/1TAxXCP

Enjoy coding!

How to export MySql database using command prompt

Sometimes requirement comes to export a database. So, doing it through export option in MySql becomes time-taking.

To overcome that so as to save some time, one can take the help of command line to export the database.

Use this command to export your database:
mysqldump -u UserName -p DatabaseName > CustomFileName.sql

You will then be prompted for the database password. Entering the password will export the database to the path you are currently-in while executing the command.

Reference: http://bit.ly/1TAxXCP

Enjoy Coding!

How to check magento version in shell/console

Here’s a simple way to know your installed magento’s version without logging to magento back-end or looking into the file ‘app/Mage.php’.

Use this shell command line to check Magento version after moving to your Magento root directory.

Steps:

  1. Move to your Magento root directory
  2. Type grep -A6 ‘static function getVersionInfo’ app/Mage.php
  3. You will find your Magento version in the screen.

Reference: https://magentary.com/kb/check-magento-version-in-shell-console/

Enjoy Magento!

Enable Template/Block hint in Magento

While working in magento site, sometimes it is required to enable template/block hint so as to trace the template/block loaded for the page.

These are few ways with which this can be done:
1. Run the following query on magento database:
INSERT INTO core_config_data (scope, scope_id, path, value)
VALUES (‘default’, 0, ‘dev/debug/template_hints’, 1),
(‘default’, 0, ‘dev/debug/template_hints_blocks’, 1);

After completing development, to turn off template hint in admin panel, open core_config_data table and change the ‘value’ column of the two rows you inserted to “0”.

Hope, this helps!!