Varsayalım ki çalışma listesinde git add komutu ile indexlenmeyi bekleyen bir kaç tane dosya var, ve de daha sonrada commit işlemi yapılacak ama siz bu dosyalardan bir tanesini iptal etmek istiyorsunuz. İşte bu işlem için git checkout -- kullanılır. Daha fazla bilgi için git checkout linkini tıklayın.


Mevcut durumu kontrol edelim


inanzzz@inanzzz:~/project$ git status
On branch develop
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: index.html.twig
modified: hello.html.twig

no changes added to commit (use "git add" and/or "git commit -a")

Dosyayı çalışma listesinden kaldırmak


Kazayla indexlenmesin diye dosya "index.html.twig" listeden kaldırılsın.


inanzzz@inanzzz:~/project$ git checkout -- index.html.twig
inanzzz@inanzzz:~/project$ git status
On branch develop
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: hello.html.twig

no changes added to commit (use "git add" and/or "git commit -a")