As we add more and more people to our team at NetPlenish, I find my self searching for a solid git workflow.

I have found a few pages that have inspired me.

We are using GitHub to manage our team. Although BitBucket just realeased its support for git and its half the price… Might consider the move.

I will update this as soon as i figure out one that makes sense for us.

What I Do Now

Best Practices

  • Commit Messages * Keep messages in present tense. * Keep message lines to 72 characters *

Git Aliases

My Git Config File

[user]
    name = Mark Evans
    email = my@emailaddress.com
[color]
    branch = auto
    diff = auto
    interactive = auto
    status = auto
    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
[alias]
    st = status
    ci = commit
    br = branch
    co = checkout
    df = diff
    lg = log -p
    who = shortlog -s --
    up = pull --rebase
    sync = !git up && git push
    stuff = !git add -A && git ci -a
    shove = !git stuff && git sync
[push]
    default = matching
[core]
    quotepath = false

Git Prommpt

My Git Prompt File

#Description: OSX Git Prompt - make your git repo prompts look pretty
#Installation: In your .bash_profile, add a line:  source .gitprompt
#FileName: .gitprompt
#Owner: Mark Evans:
#Stolen From: http://asemanfar.com/Current-Git-Branch-in-Bash-Prompt

c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`

parse_git_branch ()
{
    if git rev-parse --git-dir >/dev/null 2>&1
    then
        gitver=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
    else
        return 0
    fi
        echo -e $gitver
}

branch_color ()
{
    if git rev-parse --git-dir >/dev/null 2>&1
    then
        color=""
    if git diff --quiet 2>/dev/null >&2 
    then
        color="${c_green}"
    else
        color=${c_red}
    fi
    else
        return 0
    fi
    echo -ne $color
}

#Branch First
#PS1='[\[$(branch_color)\]$(parse_git_branch)\[${c_sgr0}\]] \u@\[${c_red}\]\w\[${c_sgr0}\]:'
#Branch Last
PS1=' \u@\[${c_red}\]\w\[${c_sgr0}\]: [\[$(branch_color)\]$(parse_git_branch)\[${c_sgr0}\]]'

Resources