Created
November 5, 2018 16:46
-
-
Save chmouel/d51caf729b6f697a629d15da8b735c48 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
set -x | |
set -e | |
LISTFILE=/tmp/list-of-repo-to-blank-archive.txt | |
base=/tmp/security | |
for i in $(cat ${LISTFILE});do | |
b=$(basename $i) | |
if [[ -e ${base}/${b} ]];then | |
continue | |
fi | |
git clone ${i} ${base}/${b} | |
cd ${base}/${b} | |
git checkout -b archived-and-blanked | |
find . -maxdepth 1 -not -name '.git' -not -name '.' -print0|gxargs -r0 rm -rf | |
cat <<EOF>README.md | |
<aside class="notice"> | |
This repository has been archived and resetted, you can still look at the git history for the old reference. | |
</aside> | |
EOF | |
git add . | |
git commit -a -m "Add information about archived repository" | |
git push origin -u archived-and-blanked | |
hub pull-request -o -m "Archive repository and all its files" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment