User login

diff

Understanding past changes with diff and git log

In figuring out what changed in a theme's files (an incorrectly made subtheme; instead of overriding the base themes stylesheets, changes should have gone into its own files with different names), these commands were useful.


diff -uP themes/bartik/css/colors.css sites/default/themes/dgd7theme/css/style.css > theme.diff
git log --cc sites/default/themes/dgd7theme/css/style.css > log.diff

Kept running them for the three different files, and reloading theme.diff and log.diff in gvim to see the changes. Quite convenient.

Getting a git diff with a relative path (no a/ b/ prefixes)

--no-prefix

Do not show any source or destination prefix.

Reference

http://www.kernel.org/pub/software/scm/git/docs/git-diff.html

Upgrade between Drupal versions using a diff shell script

[This should be on its way to being obsoleted by drush, but i'm using it for Drupal 7 alpha so thought i'd finally make sure it was shared.]

Download this and other useful scripts from their public repository on gitorious.

(Please use the code from the repository, the below may be out of date.)

Creating a patch with Git suitable for submitting to Drupal.org

Take the hash of a 'before' commit and the 'after' commit 'sha' hash and stay relative to the current directory and output a patch:

~/code/dgd7/drupal/sites/all/modules/views$ git diff --relative 5ac40a1 cb64d08 > 817748-views-book-hierarchy-sort-12.patch

If you've merely made the changes but not committed them you can use git diff > patch_name-1234-57.patch or if you've staged but not committed you can use git diff --cached patch_name-1234-57.patch.

See your git commit history with files modified

Git log shows you all your commit messages and the revision hash, but often git log would be more useful showing files changed. (You should still try to write commit messages as if the reader will have no context except, at best, the project itself.)

git log --name-only -5

How to make patch files to contribute to contributed modules

These instructions assume a GNU-Linux, Mac OS X, or other UNIX-y computing environment.

Follow these instructions for using CVS:

http://drupal.org/patch/create

However, if you are making a patch for a contributed module rather than Drupal core, going to the Drupal root directory doesn't make sense.

Syndicate content