1. 程式人生 > >git【取消已經commit但是未push的操作】

git【取消已經commit但是未push的操作】

git 回滾程式碼到某個commit

# 檢視commit的版本
$ git log

回退命令:

# 回退到上個版本
$ git reset --hard HEAD^ 

# 回退到前3次提交之前,以此類推,回退到n次提交之前        
$ git reset --hard HEAD~3  
    
# 回退到指定commit的版本
$ git reset --hard commit_id