git 分布式版本控制系统实现版本回溯

yum install git -y
git config --global user.name "username"
git config --global user.email "[email protected]"

git config --global core.editor vim

mkdir linuxprobe

git init

echo "testv2" > t1.txt

git add t1.txt

git commit -m "added a line of words"

随便修改文件


还原:

git log

commit 3710bf77a74240d095c7006bb967abcb4b405cef
Author: username <[email protected]>
Date:   Thu Jun 7 16:21:10 2018 +0800


    added a line of words


记信前面几个ID就行:3710b

git reset --hard 3710b

文件已经恢复到指定的版本

猜你喜欢

转载自blog.csdn.net/lsysafe/article/details/80621079