a bit a git
Posted by ark, ,
I'm in branch 'ng' and I  then branch that for my new feature ng-wizzles
so I can then do pull requests into the ng branch when I'm done.
but now someone's been checking in awesome in to ng so I want that in my ng-wizzles branch

git checkout ng
git pull origin ng
git checkout ng-wizzles
git merge ng

install git bash completion stuff.

function sourceIfExists {
  if [ -r "$1" ]; then
    source "$1"
  fi
}
export -f sourceIfExists

sourceIfExists /usr/local/etc/bash_completion.d/git-completion.bash

GIT_PROMPT=/usr/local/etc/bash_completion.d/git-prompt.sh
if [ -r "$GIT_PROMPT" ]; then
  . "$GIT_PROMPT"
  export GIT_BRANCH=' $(__git_ps1 "(%s)")'
else
  export GIT_BRANCH=''
fi

function branch {
  __git_ps1 "%s"
}
export -f branch

use GIT_BRANCH in your PS1
and use $(branch) when you want the current branch in a command shell

Comments