Drupal Development Bits & Notes


July 8, 2015

  1. Applying patches
    • patch -p1 < ~/drupalPatchPath/SA-CORE-2014-005-D7.patch (this sample is for the Drupageddon vulnerability)
    • Take note to change your working directory to the drupal root or the module to be patched.
    • cd /path_to_drupal_root or cd /path_to_drupal_module_to_be_patched
    • issue the patch -p1 command from within the directory above.

  2. Untrack file in git, as if it has been ignored from the start
    •  git rm --cached <file-path>

  3. Setting local branch to exactly match remote branch
  •  git fetch origin
  • git reset --hard origin/master

  • If for some reason, your drupal database lost the user 1 record, below is how to restore it:
  • Redirect all url to https by adding this to the .htaccess:
    • # Redirect to HTTPS
      RewriteCond %{HTTPS} off
      RewriteCond %{HTTP:X-Forwarded-Proto} !https
      RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  • See changed files on a commit: git show --name-only {commit}

  • Stock Photos Source 
  • Amend previous commit
      • git commit --amend