2019独角兽企业重金招聘Python工程师标准>>>
$ git log --pretty=raw --graph
* commit 943cbf390f0f303ef2326d9b425be10b9734e8a6
| tree c66db9b13ea91d7bfb8733827c35638bd8705a56
| parent 5fdeb61b5f4e8ee536388d614b16672a78cccaf9
| author paohaijiao <goudingcheng@sina.com> 1453613536 +0800
| committer paohaijiao <goudingcheng@sina.com> 1453613536 +0800
|
| commit3
|
* commit 5fdeb61b5f4e8ee536388d614b16672a78cccaf9
| tree 08585692ce06452da6f82ae66b90d98b55536fca
| parent 53dbfbd846c22b7af923163e7d8328d6511f373f
| author paohaijiao <goudingcheng@sina.com> 1453612050 +0800
| committer paohaijiao <goudingcheng@sina.com> 1453612050 +0800
|
| commit2
|
* commit 53dbfbd846c22b7af923163e7d8328d6511f373f
tree 65a457425a679cbe9adf0d2741785d3ceabb44a7
author paohaijiao <goudingcheng@sina.com> 1453611723 +0800
committer paohaijiao <goudingcheng@sina.com> 1453611723 +0800
commit
Administrator@VJNPCNLRQR7J0ME /cygdrive/d/test/demo5
git reset重置
git reflog
git reflog show master |head 5
如果修改某个文件 (没有git add 已经被提交过)想撤销这次修改
git checkout a.txt
入股修改某个文件(git add已经在暂存区),想撤销这次修改
git rest a.txt
如果已修改某几个文件,但想撤销到某个版本,但是当前暂存区,工作区不想撤销
git rest --soft commitid
如果修改了几个文件也提交暂存区了,想撤销到某个commit(确定不要了)其实还可以找回
git rest --hard commitid
$ cat .git/head
ref: refs/heads/dev
Administrator@VJNPCNLRQR7J0ME /cygdrive/d/test/demo5
$ git branch -v
* dev 943cbf3 commit3
master 943cbf3 commit3
$ git reflog
943cbf3 HEAD@{0}: checkout: moving from master to dev
943cbf3 HEAD@{1}: commit: commit3
5fdeb61 HEAD@{2}: commit: commit2
53dbfbd HEAD@{3}: commit (initial): commit
分离头指针
cat .git/head
git branch
git checkout
git reflog
挽救头指针
git checkout
git checkout file
git checkout目录
8.git checkout /git reset /git stash