Git --continue vs --no-verify

I use git commit hooks to run my code through code sniffer prior to commit.  If the code is not up to code style standards, the commit fails and you have to go fix it before it will commit.  In some rare instances (kept to a minimum of course) there is code that will just not pass code style review.  In those cases it is best to wrap the code to make it exclude review.

Useful shell aliases for git

There are a lot of steps I end up doing with git repeatedly, especially when using a pull request workflow, so I make shell aliases out of them (either bash or zsh).   Some could be just as easily done as git aliases if you prefer.

Exporting a subdirectory from a repo into a new repo

There are times when it is handy to export a subdirectory in repo into a new repo where you want to maintain the original git history of the files.  Example: During the course of building a drupal site, a custom module is ready to become a contrib module, so it needs to be in a separate repository.

There are two methods

Method 1: Strip everything from a copy of the repo

  1. mkdir NewExport

  2. cd NewExport

  3. git clone <repo>

  4. cd into the cloned repo

Fake Git submodules : Better git inside of git

I have used git submodules and they are more trouble and pain than they are worth.

I find this approach to be nicer and an easier way to handle a git repo inside a git repo.

Drupal Code Style Review Git Commit Hooks

A nice feature for protecting a repository from badly formatted code that violates Drupal coding standards is to install Coder at the global drush level (not in a specific website) and then use Drupal Code Quality (dcq) to run that code review as a git commit hook that runs as you attempt to commit your code.

Installation instructions are here.

Drupal Code Style Review

Do review you Drupal code for style:
Install coder and enable enable it
drush dl coder
drush en coder

Then to run code style review on any module, cd into the module

drush dcs

Or on a specific file:

Git shared workflow

This is the very basic idea behind a pull request based workflow.

The basic github pulll request workflow

  1. Pull from a prime remote repositiory. (never push to this repo)
  2. Commit your work locally and push to your remote fork
  3. Use github to create a pull request to the prime repo.


git remotes

Simple commands needed for working with multiple remotes in git.

List of remotes

git remote -v

Add a remote

git remote add remoteName http://url

Rename a remote

git remote rename oldname newname

Checkout a remote branch

git checkout -b branchname remotename/branchname

Delete a remote

zshell a better shell

install zshell
then extend it with oh-my-zshell

Very helpful using it with the git plugin

Change MY git email

I used this at the terminal to change my git address from one to the other thoughout the working branch


Subscribe to RSS - GIT