首页 > 学院 > 开发设计 > 正文

revert_by_date

2019-11-06 07:58:31
字体:
来源:转载
供稿:网友

revert_by_data.sh

#!/bin/sh#date format rfc2822, example:#"Wed APR 16 13:24:58 2014 +0800"、"2014-04-16"、"1996-12-19 16:39:57+08:00"if [ $# -lt 2 ]then echo "[usage]: ./revert_by_date [location_dir] [date]" exit 1fiLOCATION_DIR="$1"DATE_REVERTED="$2"for PACKAGE_PATH in `find $LOCATION_DIR -name ".git" | awk -F".git" '{print $1}'`do if [ "$LOCALPATH" = ".repo/manifests/" ] || [ "$LOCALPATH" = ".repo/repo/" ] then continue; fi CURRENT_PATH=`pwd` echo $PACKAGE_PATH cd $PACKAGE_PATH COMMIT_ID=`git log --pretty="%H" --before="$DATE_REVERTED" -1` if [ -n "$COMMIT_ID" ] then git reset --hard $COMMIT_ID else echo 'no commit found before $DATE_REVERTED' fi cd $CURRENT_PATHdone
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表