ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

reposync

2021-06-29 10:00:23  阅读:254  来源: 互联网

标签:02d git color repo pvc time reposync


repo forall -pvc git stash | tee

repo forall -pvc git checkout | tee

repo forall -pvc git reset --hard HEAD | tee

repo forall -pvc git clean -dfx | tee

使用 | tee是为了避免分屏导致的输出暂停

注意这个操作会导致本地未commit的或者commit了但是没建分支的代码丢失

 

使用下面的命令sync

repo sync -c -d --force-sync --force-broken --no-tags

-c 的意思是只下载manifest中定义的当前分支,不下载其他分支,manifest中默认会开启 -c

-d 的意思脱离本地分支,切换到服务器的分支,前提是本地代码要clean

--no-tags 不下载 tag,可以减少时间,节省空间,一般情况下我们也用不到tag

 

#!/bin/bash


color_black_on="printf \033[30m"
color_red_on="printf \033[31m"
color_green_on="printf \033[32m"
color_yellow_on="printf \033[33m"
color_blue_on="printf \033[34m"
color_purple_on="printf \033[35m"
color_cyan_on="printf \033[36m"
color_white_on="printf \033[37m"

color_off="printf \033[0m"


date
start_time0=`date +%s`
echo ""

$color_red_on
ls -l .repo/manifest.xml
$color_off
echo ""

$color_yellow_on
ls -l .repo/manifest.xml
$color_off
echo ""

$color_cyan_on
ls -l .repo/manifest.xml
$color_off
echo ""


#------------------------------------------


$color_green_on
echo "repo forall -pvc git stash"
$color_off
start_time=`date +%s`
repo forall -pvc git stash | tee
time=$((`date +%s` - start_time))
$color_green_on
printf "git stash end, time: %02d:%02d:%02d\n\n" $((time/3600)) $((time%3600/60)) $((time%60))
$color_off

$color_green_on
echo "repo forall -pvc git checkout"
$color_off
start_time=`date +%s`
repo forall -pvc git checkout | tee
time=$((`date +%s` - start_time))
$color_green_on
printf "git checkout end, time: %02d:%02d:%02d\n\n" $((time/3600)) $((time%3600/60)) $((time%60))
$color_off

$color_green_on
echo "repo forall -pvc git reset --hard HEAD"
$color_off
start_time=`date +%s`
repo forall -pvc git reset --hard HEAD | tee
time=$((`date +%s` - start_time))
$color_green_on
printf "git reset end, time: %02d:%02d:%02d\n\n" $((time/3600)) $((time%3600/60)) $((time%60))
$color_off

$color_green_on
echo "repo forall -pvc git clean -dfx"
$color_off
start_time=`date +%s`
repo forall -pvc git clean -dfx | tee
time=$((`date +%s` - start_time))
$color_green_on
printf "git clean end, time: %02d:%02d:%02d\n\n" $((time/3600)) $((time%3600/60)) $((time%60))
$color_off

$color_green_on
echo "repo sync -c -d --force-sync --force-broken --no-tags"
$color_off
start_time=`date +%s`
repo sync -c -d --no-tags
time=$((`date +%s` - start_time))
$color_green_on
printf "repo sync end, time: %02d:%02d:%02d\n\n" $((time/3600)) $((time%3600/60)) $((time%60))
$color_off


date
time=$((`date +%s` - start_time0))
$color_green_on
printf "Total time: %02d:%02d:%02d\n" $((time/3600)) $((time%3600/60)) $((time%60))
$color_off

标签:02d,git,color,repo,pvc,time,reposync
来源: https://www.cnblogs.com/xuezhongmuye/p/14948578.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有