4. Undo & Recovery

6 thẻ

Review deck này
Tất cả thẻ trong deck

`git restore <file>`

discard thay đổi trong working directory (unstaged)

`git restore --staged <file>`

unstage file (giữ thay đổi)

`git reset HEAD~1`

undo commit cuối, giữ thay đổi **unstaged** (default = `--mixed`)

`git revert <hash>`

tạo commit mới đảo ngược commit cũ (an toàn cho shared branch)

`git reflog`

xem lịch sử HEAD, tìm lại commits "bị mất"

`git stash`

lưu tạm thay đổi chưa commit

4. Undo & Recovery – Flashcards – Git | Học Dev