Skip to content

Commit

Permalink
Added a simple bash script to install git-extras as aliases on global
Browse files Browse the repository at this point in the history
git config.

Some people (like me) would prefer not to install git-extras' binaries
into /usr/bin/local but rather use them as git aliases.
I've added this script to fit that purpose.

git update-extras, simply update the git-extras local copy by pulling.
  • Loading branch information
vic committed Sep 12, 2010
1 parent 3f5afc1 commit a9f87ea
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions config-git-alias.sh
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

# from http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-in
SCRIPT_PATH="${BASH_SOURCE[0]}";
if([ -h "${SCRIPT_PATH}" ]) then
while([ -h "${SCRIPT_PATH}" ]) do SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`; done
fi
pushd . > /dev/null
cd `dirname ${SCRIPT_PATH}` > /dev/null
SCRIPT_PATH=`pwd`;


# Add an alias for each git-* script
for bin in $SCRIPT_PATH/bin/git-*; do
cmd=$(basename $bin | sed s#git-##g)
echo git $cmd
git config --global alias.$cmd "!$bin"
done
# Update git-extras by simply pulling from remote.
git config --global alias.update-extras "!(cd $SCRIPT_PATH && git pull)"

0 comments on commit a9f87ea

Please sign in to comment.