打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
使用android系统的git-repo工具

 

出处:http://blog.chinaunix.net/u1/38994/showart_2329621.html

一.创建跟踪分支
创建跟踪分支,可以使用如下3种方式
1.使用repo start
2.使用git branch --track origin/master pool
3.使用git checkout -b pool origin/master
4.批量创建repo forall -c 'repo start pool .'
(可以使用repo abandon pool删除分支)

二.创建完跟踪分支之后,就可以直接同步merge远程代码到上面建立的比如pool跟踪分支了
repo sync

三.使用如下脚本gd或gd2查看自己本地所有修改了的但还未push回reporsitory的内容
---lgit_diff脚本-------------
#!/bin/bash
path=$1

if [ $path ] && [ -d $path ] ; then
    cd $path
    [ $2 ] && name_only="--name-only"
else
    [ $path ] && name_only="--name-only" && path=''
fi

remote=`git remote`
remote_name=`git branch -r | sed '/->/!d;s!.*/!!'`
diffs=`git diff $remote/$remote_name --name-only`

if [ "$diffs" ]; then
    echo "=========================================="
    [ $path ] && echo $path
    [ "$name_only" = "" ] && echo
#   repo sync .
    git diff $remote/$remote_name $name_only
fi

[ $path ] && cd - > /dev/null

---gd脚本-------------
#!/bin/bash
# repo sync
repo forall -c 'pwd' | xargs -l1 -I file lgit_diff file $1

---gd2脚本-------------
#!/bin/bash
repo sync
repo forall -c 'pwd' | xargs -l1 -I file lgit_diff file $1

四.进入相应修改目录,直接git reset去掉无用的log
git reset hashid
git commit -am '写一些此次提交综合的说明文字'

五.使用如下脚本进行check in或者
使用repo forall -c 'pwd' | xargs -l1 Sync2GitServerReporsitory统一提交多个变更的git库
---Sync2GitServerReporsitory脚本-------------
#!/bin/bash
path=$1
[ $path ] && cd $path

remote=`git remote`
remote_name=`git branch -r | sed '/->/!d;s!.*/!!'`
local_name=`git branch | sed '/\*/!d;s/\*\ //'`

# We must Create a tracking branch, could use the following 3 ways
# 1. repo start $remote_name .
# 2. git branch --track origin/master pool
# 3. git checkout -b pool origin/master
# 4. 或者repo forall -c 'repo start pool .'批量创建

git pull $remote $remote_name
git push $remote $local_name:$remote_name

[ $path ] && cd - > /dev/null
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Repo命令指南(翻译自官方文档)-转
Repo 详解
建本地 repo server --- 超复杂型 -- 备份
git repo
创建android下repo的mirror镜像然后内网访问
Repo和Git 版本管理常用命令
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服