Git克隆历史的某个版本
Simba1949 人气:0步骤
查看历史记录
# 查看历史记录git log -3
实例
Simba@SIMBA MINGW64 /t/IDE/IDEA/Workspace-Learn/config-center ((af05c43...)) $ git log -3 commit af05c43b5c6b14abbe9c6267811e4fb0a2d2b372 (HEAD, origin/master, origin/HEAD, master) Author: Simba1949 <simba1949@outlook.com> Date: Sun Jul 28 17:27:54 2019 +0800 springcloud多环境配置文件 commit d124e2b35da7a9b51368e5f2d156b1128781c517 Author: Simba1949 <simba1949@outlook.com> Date: Sun Jul 28 16:39:14 2019 +0800 SpringCloudConfig 多环境配置文件 commit acb80687cd82151f1beba3518c6a5327fad91c9a Author: Simba1949 <simba1949@outlook.com> Date: Sun Jul 28 11:40:10 2019 +0800 SpringCloud 学习笔记之分布式配置中心Config的学习,上传配置文件
选择要克隆的历史版本,克隆对应的历史版本数据
# 选择需要克隆的历史版本 git checkout acb80687cd82151f1beba3518c6a5327fad91c9a
实例
Simba@SIMBA MINGW64 /t/IDE/IDEA/Workspace-Learn/config-center ((af05c43...)) $ git checkout acb80687cd82151f1beba3518c6a5327fad91c9a Previous HEAD position was af05c43 springcloud多环境配置文件 HEAD is now at acb8068 SpringCloud 学习笔记之分布式配置中心Config的学习,上传配置文件
最后在恢复到最新数据
# 恢复最新数据 git pull origin master
实例
Simba@SIMBA MINGW64 /t/IDE/IDEA/Workspace-Learn/config-center ((acb8068...)) $ git pull origin master From https://github.com/simba1949/config-center * branch master -> FETCH_HEAD Updating acb8068..af05c43 Fast-forward .../default/spring-cloud-config-multi-client.properties | 1 + .../dev/spring-cloud-config-multi-client-dev.properties | 1 + .../prod/spring-cloud-config-multi-client-prod.properties | 1 + .../spring-cloud-config-multi-client-dev.properties | 1 + .../spring-cloud-config-multi-client-prod.properties | 1 + .../spring-cloud-config-multi-client-test.properties | 1 + .../test/spring-cloud-config-multi-client-test.properties | 1 + 7 files changed, 7 insertions(+) create mode 100644 spring-cloud-config-multi-client/default/spring-cloud-config-multi-client.properties create mode 100644 spring-cloud-config-multi-client/dev/spring-cloud-config-multi-client-dev.properties create mode 100644 spring-cloud-config-multi-client/prod/spring-cloud-config-multi-client-prod.properties create mode 100644 spring-cloud-config-multi-client/spring-cloud-config-multi-client-dev.properties create mode 100644 spring-cloud-config-multi-client/spring-cloud-config-multi-client-prod.properties create mode 100644 spring-cloud-config-multi-client/spring-cloud-config-multi-client-test.properties create mode 100644 spring-cloud-config-multi-client/test/spring-cloud-config-multi-client-test.properties Simba@SIMBA MINGW64 /t/IDE/IDEA/Workspace-Learn/config-center ((af05c43...))
演示
Git 最新版本数据
克隆历史版本后
最终恢复到最新版本数据
命令演示
以上为个人经验,希望能给大家一个参考,也希望大家多多支持。
加载全部内容