V4if 's Blogwebsite

Fuck

发表于2016-12-18
默认

经历一次本地文件丢失事故,决定用gitcaffe做全目录git备份!
新的起点,Powerd by Plane UI 前端UI设计框架
github和gitcafe同时部署,双域名:v4if.github.iov4if.coding.me

对原来的文章能找到的文件就直接粘过来了,没有找到的就选取了一部分挂在网站上的文章然后重新整理了一下


遇到痛点,自然就是想到解决办法,利用git天然的版本控制系统做文件备份,由于墙内github时不时抽风,采用gitcafe作为备份git服务器,现在已经被coding收购了

重要目录,需要及时热备份的地方创建hotpatch脚本处理文件,每次版本更新或者文件变动的时候,push最新文件改动,并对每次push的内容打一个时间戳的tag,方便数据灾难或者版本回滚的时候根据tag拉取历史版本

hotpatch,创建git repository的过程省略了,本文repo的ssh地址为:git@git.coding.net:v4if/hotpatch.git,因此本地需要git remote add origin git@git.coding.net:v4if/hotpatch.git添加远程仓库地址

#!/bin/bash
git add .
git commit -m "hotpatch"

tag_name=`date "+V%Y%m%d.T%H%M%S"`
git tag -a ${tag_name} -m "hotpatch"

git push origin master
git push origin --tags

fuck

在出现数据灾难或者版本回滚时,根据具体的时间戳tag拉取对应版本,恢复数据

$ git clone git@git.coding.net:v4if/hotpatch.git
$ git tag #查看tag
$git checkout tags/<tag_name> -b <branch_name>

血的教训,及时做好重要数据文件的备份!