Posts

Showing posts from April, 2014

Committing partial changes from file in Git

git add -p file -p stands for patch mode, You can also use git add --patch file This gives the user a chance to review the difference before adding modified contents to the index.

Revert the pushed code in wrong git branch using Cherry pick

git checkout wrong_branch git revert commitsha1 # Code for wrong commit git revert commitsha2 # Code for wrong commit git checkout right_branch git cherry-pick commitsha1 # Code for wrong commit git cherry-pick commitsha2 # Code for wrong commit   If you have multiple commits and there are no commits pushed after your dirty commits, you can even use git reset to get that wrong branch to a state just before your commits and then follow that again using git cherry-pick to get your commits into the right branch. git checkout wrong_branch git reset commitsha3 #commit just before commitsha2, this will reset the whole branch to previous state git checkout right_branch git cherry-pick commitsha1 git cherry-pick commitsha2

Install phpMyAdmin with mysql on ubuntu

To install it on your ubuntu system you can use apt-get which is the easiest way. phpMyAdmin is a good option, if you don't want to install LAMPP. Please follow the below mentioned steps, these will guide you through each and every step of installation. Step 1 sudo apt-get install phpmyadmin Step 2 Select Apache2 for the server Step 3 Choose YES when asked about whether to Configure the database for phpmyadmin with dbconfig-common Step 4 Enter your MySQL password when prompted Step 5 Enter the password that you want to use to log into phpmyadmin Step 6 After the installation has completed, add phpmyadmin to the apache configuration. sudo nano /etc/apache2/apache2.conf If you are not comfortable with nano, you can use gedit sudo gedit /etc/apache2/apache2.conf Step 7 Add the phpmyadmin config to the file. Include /etc/phpmyadmin/apache.conf Step 8 Restart apache: sudo service apache2 restart

Quickest way to resolve Git Merge Conflicts

The solution which is provided below is one of the most easiest way to resolve git merge conflicts If you wanted to accept ours changes and remove theirs, run: git checkout --ours PATH/FILE If you wanted to accept theirs changes and remove ours, run: git checkout --theirs PATH/FILE If you have multiple files, you can use the following commands. grep -lr '<<<<<<<' . | xargs git checkout --ours grep -lr '<<<<<<<' . | xargs git checkout --theirs

HTML 5 + Local Storage or event.dataTransfer

Here is the most basic example to save data inside HTML5 local storage. localStorage.setItem("acomplexname", "text data to be saved"); localStorage.getItem("acomplexname"); localStorage.removeItem("acomplexname"); Local storage is a good alternative for event.dataTranfer because some browsers are restrictive and doesn't allow outside world to fetch data, a bit more detail can be found here  Bug event.dataTransfer.setData('text/plain', "data to be saved"); event.dataTransfer.getData('text/plain');