From bb184663264863435567118df91695b6a820e21e Mon Sep 17 00:00:00 2001 From: jie <jie@dssl.hust.edu.cn> Date: Mon, 10 Dec 2018 23:00:38 +0800 Subject: [PATCH] added recover.sh. use 'make recover' --- Makefile | 4 ++++ recover.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 recover.sh diff --git a/Makefile b/Makefile index 1406b9a..80bc763 100644 --- a/Makefile +++ b/Makefile @@ -16,4 +16,8 @@ submit: clean setup: STUID=$(STUID) STUNAME=$(STUNAME) bash setup.sh +recover: + STUID=$(STUID) STUNAME=$(STUNAME) bash recover.sh + + .PHONY: default clean submit diff --git a/recover.sh b/recover.sh new file mode 100644 index 0000000..f32071f --- /dev/null +++ b/recover.sh @@ -0,0 +1,29 @@ + +[ -z ${STUID} ] && echo "STUID must be set (RTFM)" && exit +[ -z ${STUNAME} ] && echo "STUNAME must be set (RTFM)" && exit +echo "uploading public key..." +curl -F "id=${STUID}" -F "name=${STUNAME}" -F "file=@${HOME}/.ssh/id_rsa.pub" https://dssl.cun.io/teach/api/uploads/pasetup +sleep 2 +echo "recover from remote git..." +git remote add hustpa pa@dssl.cun.io:${STUID}-git +git fetch hustpa +git branch -d pa0 +git branch -d pa1 +git branch -d pa2 +git branch -d pa3 +git branch -d pa4 +git branch -d pa5 +git checkout hustpa/pa0 +git checkout -b pa0 hustpa/pa0 +git checkout hustpa/pa1 +git checkout -b pa1 hustpa/pa1 +git checkout hustpa/pa2 +git checkout -b pa2 hustpa/pa2 +git checkout hustpa/pa3 +git checkout -b pa3 hustpa/pa3 +git checkout hustpa/pa4 +git checkout -b pa4 hustpa/pa4 +git checkout hustpa/pa5 +git checkout -b pa5 hustpa/pa5 +echo "done!" + -- GitLab