Option --amend của git commit cho phép bạn ghi đè lại commit mới nhất.
lvduit@lvduit:~/project/x/(master)$ git commit --amend
Lúc này git sẽ cho phép bạn viết lại commit message. Cách này hay dùng khi muốn sửa commit message.
Nếu bạn chỉ muốn add thêm file mà không muốn sửa commit message thì có thể dùng option --no-edit
# Đây là commit sai / thiếu
lvduit@lvduit:~$ git add helper.js
lvduit@lvduit:~$ git commit -m 'Add Helper module'
# Nhận ra là add thiếu file và muốn thêm vào commit bên trên
lvduit@lvduit:~$ git add model.js
lvduit@lvduit:~$ git commit --amend --no-edit
Tôi là Duyệt