linux 终端常用命令操作的一些语法糖总结

 
更多

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"
}
打赏

本文固定链接: https://www.cxy163.net/archives/3097 | 绝缘体

该日志由 绝缘体.. 于 2023年01月01日 发表在 未分类 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: linux 终端常用命令操作的一些语法糖总结 | 绝缘体
关键字: , , , ,

linux 终端常用命令操作的一些语法糖总结:等您坐沙发呢!

发表评论


快捷键:Ctrl+Enter