赞
踩
本文旨在解决使用idea过程中,提交和合并代码时idea卡顿和响应慢以及过程繁琐的问题。
写一个脚本,命名为 .bashrc ,内容如下
alias gs="git status" # to see changes that have been staged and which haven't alias ga="git add . " # add alias gb="git branch" # branches alias gf="git fetch origin --recurse-submodules=no --progress --prune" # git fetch alias gbr="git branch -r" # remote branches alias gcu="git rev-parse --abbrev-ref HEAD" # current branch alias gac="git add . && git commit -m" # to stage and commit changes #git push and pull alias gp="git push" # + remote & branch names alias gpl="git pull" # + remote & branch names # Pushing/pulling to origin remote alias gpo="git push origin" # + branch name alias gcb="git checkout -b" # To create a new branch and checkout into it alias gcm="git checkout master" alias gcmp="git checkout master && git pull" alias gct="git checkout test" alias gctp="git checkout test && git pull" alias gcp="git checkout pre" alias gcpp="git checkout pre && git pull" alias gcd="git checkout dev" alias gcdp="git checkout dev $$ git pull" alias gl="git log" alias g="git" alias gd="git branch -d" alias mc="mvn clean" alias mci="mvn clean -U install -Dmaven.test.skip=true " alias mcc="mvn clean -U compile -Dmaven.test.skip=true " alias md="mvn -Dfile.encoding=UTF-8 smart-doc:rpc-html " alias mr="mvn spring-boot:run" # pull add commit push gacp(){ git pull && git add . && git commit -m "$1" && git push;} gmttp(){ currentbranch=$(git rev-parse --abbrev-ref HEAD) git checkout test && git pull && git merge "$currentbranch" && git push && git checkout "$currentbranch"; } gmttpi(){ currentbranch=$(git rev-parse --abbrev-ref HEAD) git checkout test && git pull && git merge "$currentbranch" && git push && mci && git checkout "$currentbranch"; } gmtpp(){ currentbranch=$(git rev-parse --abbrev-ref HEAD) git checkout pre && git pull && git merge "$currentbranch" && git push && git checkout "$currentbranch"; } gmttp2(){ currentbranch=$(git rev-parse --abbrev-ref HEAD) git checkout "$1" && git pull && git merge "$currentbranch" && git push && git checkout "$currentbranch"; } # 合并代码,不切换回来 gm(){ currentbranch=$(git rev-parse --abbrev-ref HEAD) git pull && git add -A && git commit -m $1 git push && git checkout $2 && git pull git merge "$currentbranch" && git push } # 合并代码 切换回来 gmc(){ currentbranch=$(git rev-parse --abbrev-ref HEAD) git pull git add -A git commit -m $1 git push git checkout $2 git pull git merge "$currentbranch" git push git checkout "$currentbranch" } # push新分支 gpNew(){ currentbranch=$(git rev-parse --abbrev-ref HEAD) git push --progress --porcelain origin refs/heads/$currentbranch:refs/heads/$currentbranch --set-upstream } gdRemote(){ git push --progress --porcelain origin :$1 } gc(){ git checkout $1 && git pull } # 切换分支 ,存在分支,直接切换,不存在时从master拉取新分支并提交 gcSafe(){ git checkout $1 if [ $? -eq 0 ] ; then echo "$1 分支存在,切换成功。" git pull else echo "$1 分支不存在,开始新建" sourceBranch=master if [ -n "$2" ]; then sourceBranch=$2 fi git checkout -b $1 origin/$sourceBranch^0 -- echo "从 $sourceBranch 拉取远程分支 $1 成功" git push --progress --porcelain origin refs/heads/$1:refs/heads/$1 --set-upstream echo "push 成功!" fi } # 编辑本文件 eb(){ echo "开始编辑.bashrc文件===" open ~/.bashrc } # 加载本文件 rb(){ source ~/.bash_profile echo "执行成功!" } # 给文件设置最高权限 c7(){ chmod 777 $1 } #去桌面 god(){ cd ~/Desktop }
将文件复制到用户目录(~)下,然后在~/.bash_profile(没有该文件新建一个)中添加如下内容
source ~/.bashrc
终端中执行 source ~/.bash_profile
在idea中,打开终端,输入命令:
实际能使用的功能是非常多的,我这里只是简单的举例,可以自己扩展,希望能帮到你。
关于windows 中的使用实际也很简单:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。