删除android repo信息,关于如何高效使用android系统的git-repo工具

一.创建跟踪分支

创建跟踪分支,可以使用如下4种方式

1.使用repo start

2.使用git branch -t pool origin/master

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`

local_name="`git branch | sed '/\*/!d;s/\*\ //'`"

#remote_name="`git repo-config -l | \

#    sed "/^branch\.$local_name\.merge=/!d;s/^branch\.$local_name\.merge=//" | \

#    sed 's/^.*\///'`"

remote_name="`git repo-config -l | \

sed "/^branch\.$local_name\.merge=/!d;s/^branch\.$local_name\.merge=//"`"

[ "$remote_name" == "" ] && echo "[ $local_name ] not a track branch --> `pwd`" && exit 0

mydiffs="$remote_name"

[ "$(echo $remote_name | cut -d'/' -f1)" = "$remote_name" ] && mydiffs="$remote/$remote_name"

diffs=`git diff $mydiffs --name-only`

if [ "$diffs" ]; then

echo "=========================================="

[ $path ] && echo $path

[ "$name_only" = "" ] && echo

#   repo sync .

git diff $mydiffs $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`"

local_name="`git branch | sed '/\*/!d;s/\*\ //'`"

remote_name="`git repo-config -l | \

sed "/^branch\.$local_name\.merge=/!d;s/^branch\.$local_name\.merge=//" | \

sed 's/^.*\///'`"

[ "$remote_name" == "" ] && echo "[ $local_name ] not a track branch --> `pwd`" && exit 0

# We must Create a tracking branch, could use the following 3 ways

# 1. repo start $remote_name .

# 2. git branch -t pool origin/master

# 3. git checkout -b pool origin/master

git pull $remote $remote_name

git push $remote $local_name:$remote_name

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值