命令
git reset --hard xxx
查看提交記錄
git log
commit 15bfcbfccb4a6875b1a891e7ec13de74f1c032fa (HEAD -> master, origin/master, origin/HEAD)
Author: Allan <a@gmail.com>
Date: Fri Oct 26 17:50:54 2018 +0800
Create README.md
commit c9a80a3cf366bb7532efe869c1753b37e30af94c
Author: Allan <a@gmail.com>
Date: Tue Oct 23 19:17:35 2018 +0800
finished
commit 5ab542d8f71808afb620b859a976f0b28c853961
Author: Allan <a@gmail.com>
Date: Tue Oct 23 18:56:47 2018 +0800
readme
commit 19895957ae64610711b3b23eeab56141c0a3e78a
Author: Allan <a@gmail.com>
Date: Tue Oct 23 18:55:50 2018 +0800
update .gitignore
:
回滾到某次commit,比如第二次:c9a80a3cf366bb7532efe869c1753b37e30af94c
git reset ---hard c9a80a3cf366bb7532efe869c1753b37e30af94c
此時(shí)本地代碼是 c9a80a3cf366bb7532efe869c1753b37e30af94c 那次的涡上!
假如要強(qiáng)制提交:
git push -f