##分别进行四次提交
wangjunjie@z0410200075 MINGW64 /e/test/test (master)
$ git log --oneline
6732512 this is fourth change
b08208d third change
e559822 second commit
a5808f7 create test file
##回滚到前两次之前提交(e559822... second commit)
wangjunjie@z0410200075 MINGW64 /e/test/test (master)
$ git revert HEAD~2
error: could not revert e559822... second commit
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
##因为改的同一份文件,产生冲突
wangjunjie@z0410200075 MINGW64 /e/test/test (master|REVERTING)
$ git status
On branch master
You are currently reverting commit e559822.
(fix conflicts and run "git revert --continue")
(use "git revert --abort" to cancel the revert operation)
Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: test.txt
no changes added to commit (use "git add" and/or "git commit -a")
##进入冲突文件解决冲突
wangjunjie@z0410200075 MINGW64 /e/test/test (master|REVERTING)
$ vi test.txt
##解决完冲突后,加入缓存
wangjunjie@z0410200075 MINGW64 /e/test/test (master|REVERTING)
$ git add -A
##提交,回滚完成
wangjunjie@z0410200075 MINGW64 /e/test/test (master|REVERTING)
$ git commit -m 'solutiong confilic'
[master 12be922] solutiong confilic
1 file changed, 1 insertion(+), 3 deletions(-)
wangjunjie@z0410200075 MINGW64 /e/test/test (master)
网友评论