浏览代码

add git functions

pull/1/head
10sr 12 年前
父节点
当前提交
96907fd95e
共有 1 个文件被更改,包括 40 次插入0 次删除
  1. +40
    -0
      .bashrc

+ 40
- 0
.bashrc 查看文件

@@ -71,6 +71,46 @@ alias pcalc="python -i -c 'from math import *' "
# alias diff="$(type colordiff >/dev/null 2>&1 && test $TERM != dumb && echo color)diff -u"
# type trash >/dev/null 2>&1 && alias rm=trash

export __MYGITBAREREP="${HOME}/dbx/.git-bare"
git-make-bare-rep(){
test $# -eq 0 && {
echo "specify repository name." 1>&2
return 1
}

dir="${__MYGITBAREREP}/$1.git"

if test -d "$dir"
then
echo "dir $dir already exist!" 1>&2
else
mkdir -p "$dir" &&
pushd "$dir" &&
git init --bare
popd
fi
}

git-add-bare-rep(){
test $# -ne 2 && {
echo "specify repository name and shortname." 1>&2
return 1
}

dir="${__MYGITBAREREP}/$2.git"
git-make-bare-rep $2 &&
git remote add $1 "$dir"
git remote -v

# if test -d "$dir"
# then
# git remote add $1 "$dir"
# git remote -v
# else
# echo "dir $dir does not exist!" 1>&2
# fi
}

bak(){
for file in "$@"
do


正在加载...
取消
保存