geek rescue kit Code
Brought to you by:
ctaf
#!/bin/sh
##
## gitkernel.sh
## Login : <ctaf@localhost.localdomain>
## Started on Wed Apr 16 11:53:38 2008 Cedric GESTES
## $Id$
##
## Author(s):
## - Cedric GESTES <gestes@aldebaran-robotics.com>
##
## Copyright (C) 2008 Cedric GESTES
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##
action=$1
arg=$2
case $action in
initremote)
echo "init a bare git repository (without local checkout)"
if [ x$arg = x ] ; then
echo "you should specify the directory name for the new git repository"
echo "usage: gitkernel initremote <folder>"
exit 1
fi
mkdir $arg
cd $arg
git init --bare
cd -
;;
checkout)
echo "checking out a git repository"
if [ x$arg = x ] ; then
echo "you should specify the git repository"
echo "<gitrepos> could be: login@server:/truc/machin/repos.git"
echo "usage: gitkernel checkout <gitrepos>"
exit 1
fi
git clone $arg
;;
update)
echo "update the current branch from remote repository"
echo "if you want to pull from another branch:"
echo "gitkernel update localbranch:remotebranch"
if [ x$arg = x ] ; then
arg="master:master"
fi
git pull origin $arg
;;
commit)
echo "commit modification"
git commit -a
;;
rcommit)
echo "commit to remote server"
echo "update the current branch from remote repository"
echo "if you want to push from another branch:"
echo "gitkernel rcommit localbranch:remotebranch"
if [ x$arg = x ] ; then
arg="master:master"
fi
git push origin $arg
;;
config)
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com
;;
*)
echo "usage:"
echo "gitkernel initremote <reponame>"
echo "gitkernel checkout <gitrepos>"
echo "gitkernel update [localbranch:remotebranch]"
echo "gitkernel commit"
echo "gitkernel rcommit [localbranch:remotebranch]"
;;
# echo "initremote create a remote repository that cannot be checkout in local"
esac