自定义Git Bash命令

步骤:

1. 环境变量:

.zshrc

# User configuration @~/.zshrc
export PATH=~/bin:"$PATH"

.bashrc

# User configuration @~/.bashrc
export PATH=~/bin:"$PATH"

2. 在~/bin下建立脚本

如:

#conflict-merge.sh
#!/bin/bash
if [ ! -n "$1" ]; then
    echo "please input from branch!";
    exit 0;
else if [ ! -n "$2" ]; then
    echo "please input to branch!";
    exit 1;
     fi
fi
git push origin $1
git fetch origin
git checkout -b $1 origin/$1
git checkout $2
git merge --no-ff $1
git push origin $2

echo 'my lord, conflict has resolved!'

3. 添加别名

alias conflict='bash conflict-merge.sh'

posted on 2016-05-15 14:16  ericzheng  阅读(1199)  评论(0编辑  收藏  举报

导航