GIT - reseting hard, moving to previous commit after merge

git reset --hard c517b565b2bcc0cf2ca5265b6ea6657f253fe2af
git push -f

to move git to previous commit and push it to remote server, we first need to reset hard to SHA value and then push it with force to overide current state

 

GIT - reverting merge (pull request gonne wrong)

Find a commit hash where merge occured to master and then

git revert -m 1 <commit-hash> 
git commit -m "Reverting the last commit which messed the repo."
git push -u origin master

 

 

Debugging ajax calls/requests

In case ajax calls are making a trouble and developer needs more information about what is happening regarding:

Dumping drupal DB without cache tables

If you want to dump DB from production or develop servers and not include cache table values for faster importing you can use below script. You need to change site_name variable and DUMPDIR to match what you have and also user/password of DB

Bash script for cloning database on server

If you need to copy DB, lets say from production to develop you can use this script and call it like "develclone.sh original_db cloned_db"
For faster cloning it will exclude cache tables data.

Get list of all the hooks your site currently uses

In includes/module.inc, find the module_implements() function (around line 715 in Drupal 7). At the top of the function, just add this below and you will get huge output of all the hooks that are called.

 

function module_implements($hook, $sort = FALSE, $reset = FALSE) {
  drupal_set_message("hook_$hook");
  ......