Wednesday, January 30, 2019

Wednesday, January 23, 2019

Good way to do git revert

UPDATE: This probably isn't as good:

I have found that doing

git revert --no-commit HEAD~(number of commits back)..

for example:

git revert --no-commit HEAD~3..

and then committing the changes is a great way to revert back to a previous commit without messing up git structure.

UPDATE: This is better:

git reset --hard (hash number) deletes all changes and goes straight to that commit.

git revert (hash number) allows you to merge changes made in that revision with the HEAD

Drupal 8 - Make sure to use if statements in hooks

When using a hook in drupal, be sure to use an if statement to assure that what you want to work with is present. The hook applies to everything on the site, and may cause issues if you are not thinking about that.