Outside Links collection

Sometimes you find just the right resources that fulfill certain need and nothing much should be added to them, in those cases I will just collect them on this page and add short comment why is this so.

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

 

 

GIT - checking status of master and differences

Before final git pull to LIVE site, it is a good idea to check what is going to be pulled. So to do that

Git fetch
git diff master origin/master

or 

git diff --name-only master origin/master

This should give you more insight on what is going to be pulled in the end, as this marks differences between current master branch on LIVE site and master on github.

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 cahce 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.