git-central icon indicating copy to clipboard operation
git-central copied to clipboard

scripts and hooks for use with a centralized git repo

Overview

Tweaks for using git in a corporate/close-team environment.

Scripts

  • checkout: does the right thing for creating/tracking a new or existing remote branch
  • push: pushes only the current branch to origin
  • pull: pulls changes down but with rebase-i-p to avoid same-branch merges and commit replays

Server-side Hooks

See the individual scripts for documentation, but an overview:

  • post-receive-commitnumbers: makes Subversion-like monotonically increasing commit numbers for every commit
  • post-receive-email: contrib email script with customizations for stuff like combined diffs
  • post-receive-gitconfig: auto-updates the git config+hooks on the server when updated in the repo
  • post-receive-hudson: auto-creates new jobs in Hudson when branches in git are created
  • post-receive-trac: updates trac tickets with messages referencing the commits
  • update-allow-tags-branches: contrib/example branch/tag enforcement script with customizations
  • update-ensure-follows: allows nomination of special branches (e.g. stable) that everyone must have merged
  • update-ensure-ticket-reference: enforces ticket references in commit messages (e.g. for trac)
  • update-lock-check: enforces locked/preserved branches
  • update-stable: enforces proper movement of stable

Client-side Hooks

  • commit-msg-trac: enforces ticket references in commit messages

Bootstrapping Scripts

  • create-gitconfig: creates a new DAG for managing repository-specific configuration (works with post-receive-gitconfig)
  • create-stable: creates a new DAG for the first release to merge in to (works with update-stable)

Install Server-side Hooks

  • Download/clone the gc repo to something like /srv/git/gc
  • Edit your_repo.git/hooks/post-receive and your_repo.git/hooks/update to call the gc hooks as appropriate
    • post-receive.sample and update.sample are good templates to use for calling multiple hooks

Todo

  • Install approach for scripts
  • Install for client hooks