linux 终端操作的一些语法糖总结:
以下代码添加到 ~/.bashrc 文件中去:
#操作命令简化 alias c='clear' alias m='git checkout master;git pull' alias p='git pull' alias d='git diff' alias s='git st' alias gc='func() { git pull; git checkout $1; git pull;}; func' alias gcb='func() { git checkout -b $1; git push --set-upstream origin $1;}; func' #git add git commit git push 三步操作合成一步操作 function g() { log=$1 files=$2 if [ ! -n "$log" ]; then echo "必须输入提交说明" return fi if [ ! -n "$files" ]; then files="." fi git add $files git commit -m "$log" git push } #快速基于 master 分支新开分支 function mb() { new_branch=$1 master_branch=$2 if [ ! -n "$master_branch" ]; then master_branch="master" fi git checkout "$master_branch" git pull git checkout -b "$new_branch" git push --set-upstream origin "$new_branch" }