版本回退

查看版本信息:
$ git log:

$ git log
commit 1094adb7b9b3807259d8cb349e7df1d4d6477073 (HEAD -> master)
Author: Michael Liao 
Date:   Fri May 18 21:06:15 2018 +0800

    append GPL

commit e475afc93c209a690c39c13a46716e8fa000c366
Author: Michael Liao 
Date:   Fri May 18 21:03:36 2018 +0800

    add distributed

commit eaadf4e385e865d25c48e7ca9c8395c3f7dfaef0
Author: Michael Liao 
Date:   Fri May 18 20:59:18 2018 +0800

    wrote a readme file

简化输出($ git log --pretty=oneline

$ git log --pretty=oneline
1094adb7b9b3807259d8cb349e7df1d4d6477073 (HEAD -> master) append GPL
e475afc93c209a690c39c13a46716e8fa000c366 add distributed
eaadf4e385e865d25c48e7ca9c8395c3f7dfaef0 wrote a readme file

一大串类似1094adb...的是commit id(版本号)
在Git中,用HEAD表示当前版本,也就是最新的提交1094adb...(注意我的提交ID和你的肯定不一样),上一个版本就是HEAD^,上上一个版本就是HEAD^^,当然往上100个版本写100个^比较容易数不过来,所以写成HEAD~100
$ git reset --hard HEAD^回到上一个版本

$ HEAD is now at e475afc add distributed

$ cat readme.txt查看文件内容
回到未来:
$ git reset --hard
commit id 通过$ git reflog查询

你可能感兴趣的:(版本回退)