Alister West

home is where your code is ...

Git Init

Stuff to do before you run 'git init'

Setup global config

# Personal info
git config --global "Alister West"
git config --global ""

# fix first commit cause i forgot to update config.
git commit --amend --author="Alister West <>"

# Always rebase [1],[2] for linear history.
git config branch.autosetuprebase always

# Always rebase this master branch
git config branch.master.rebase true

# Shortcut to unstage "git unstage myfile"
git config --global alias.unstage 'reset HEAD --'

# Colours [2]
git config --global color.ui true

# On a shared account update your .bashrc with gits environment vars.
export GIT_AUTHOR_NAME="Alister West";

Setup bare repo config

# setup bare (master) repo
git init --bare --shared foo.git; cd foo.git
git config receive.denyNonFastforwards true

# for http(s) connections
git update-server-info
vim /etc/httpd/vhosts/ "Use GIT my_project authdomain"

# populate new bare-repo from an existing project
git remote add --track master origin
git push origin master
git push --tags

# push EVERYTHING to a remote bare repo
cd mylocal_project.git
git push '*:*'

Setup project config

# Setup a remote based off an existing git repo.
git init foo; cd foo
git remote add --track master origin ssh://

Setup email notification

## myrepo.git/hooks/post-receive
git-commit-notifier git-notifier-config.yml

## myrepo.git/git-notifier-config.yml
delivery_method: sendmail
lines_per_diff:  1000
expand_css:      false

# Link with Redmine
link_files: redmine
    project: myrepo
    '#([0-9]+)([\s]|\z)': '\1'

Setup colors

# Nicer colors than the default
# Put in your global ~/.gitconfig
    ui = auto
[color "branch"]
    current = yellow reverse
    local = yellow
    remote = green
[color "diff"]
    meta = yellow bold
    frag = magenta bold
    old = red bold
    new = green bold
[color "status"]
    added = yellow
    changed = green
    untracked = cyan

Git with Bash-Completion

# gentoo/portage bash-completion
echo "dev-vcs/git webdav bash-completion" >> /etc/portage/package.use
emerge git

# Need to turn on the git option for each user..
eselect bashcomp enable git
# ... or globally
sudo eselect bashcomp enable --global git

# MacPorts bash-completion [5]
sudo port install git +svn +bash_completion
# or without re-installing git
curl > ~/

# OSX Homebrew bash-completion
brew install bash-completion
brew tap homebrew/completions
. $(brew --prefix)/etc/bash_completion

# Install
PS1="[\u@\h] \w \$(__git_ps1) \t >"
[] ~/myproj/  (master) 11:45:42 >

Ignore non-project files within a git repo

# $PROJECT/.gitignore
# Sometimes we want www, sometimes not but we always want static.

Git Initial Commit

git add .
git commit -a -m 'Initial Commit'






[4] no worky any more.

By Alister West