如题,~/.bashrc 文件内容如下:
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
######################################################################
# 自定义命令,请在保存文件后哦运行 `source ~/.bashrc` 命令以生效 #
# #
# 相关使用:http://www.voidcn.com/article/p-sdjrrhsk-nv.html #
######################################################################
################################【GIT】################################
# git branch
alias g.branch='git branch'
alias g.bra='git branch'
# git branch -d 删除分支
alias g.branch.d='git_branch_d(){ git branch -d $*; }; git_branch_d'
alias g.bra.d='git_branch_d(){ git branch -d $*; }; git_branch_d'
# git branch -d 批量删除分支
alias g.branch.d.b='git_branch_d_batch(){ git branch |grep $* |xargs git branch -D; }; git_branch_d_batch'
alias g.bra.d.b='git_branch_d_batch(){ git branch |grep $* |xargs git branch -D; }; git_branch_d_batch'
# git log 查看提交日志
alias g.log='git log'
alias g.log='git log --oneline' # 更为精炼的输出
alias g.log='git log --graph' # 以分支的可视化图显示
# git push到当前分支的远程分支,如:git push origin dev1.1.0:refs/for/dev1.1.0
alias g.push='git push origin `git symbolic-ref --short HEAD`:refs/for/`git symbolic-ref --short HEAD`'
# git pull --rebase
alias g.pull='git pull --rebase'
# git pull --rebase 的同时检出一份以备份,避免本地代码被覆盖、丢失
alias g.pull.b='cb=`git symbolic-ref --short HEAD` && dt=`date "+%Y%m%d%H%M%S"` && bb="${cb}_${dt}" && git branch backup/$bb && git pull --rebase'
# git pull --rebase 的之前先删除当前分支的所有备份分支,之后检出一份新备份,避免本地代码被覆盖、丢失
alias g.pull.c.b='cb=`git symbolic-ref --short HEAD` && dt=`date "+%Y%m%d%H%M%S"` && bb="${cb}_${dt}" && git branch |grep backup/$cb |xargs git branch -D && git branch backup/$bb && git pull --rebase'
# git rebase --continue
alias g.rebase.c='git rebase --continue'
alias g.pull.c='git rebase --continue'
# git rebase --abort 这个 rebase 垮了,报废掉它吧
alias g.rebase.a='git rebase --abort'
alias g.pull.a='git rebase --abort'
# git restore ./
alias g.restore='git restore ./'
alias g.res='git restore ./'
# git reset HEAD~1 撤销上一次的提交
alias g.reset='git reset HEAD~1'
# git status 查看当前状态
alias g.status='git status'
alias g.sta='git status'
##############################【CocoaPod】#############################
# pod install
alias p.install='pod install'
alias p.ins='pod install'
# git log
alias p.update='pod update'
# pod update
alias p.update='pod update'
alias p.up='pod update'
# pod update --no-repo-update
alias p.update.n='pod_update(){ pod update $* --no-repo-update; }; pod_update'
alias p.up.n='pod_update(){ pod update $* --no-repo-update; }; pod_update'
##############################【Source】#############################
# source ~/.bashrc
alias s.bashrc='source ~/.bashrc && echo done!'