Bir an için git add komutu ile bazı dosya ve klasöreri stage veya indexleme işlemi yaptığınızı varsayalım. Yaptığımız işleri kaybetmeden bu işlemide git reset ile geri alalım. Daha fazla bilgi için git add ve git reset linklerini tıklayın.


Mevcut durumu kontrol edelim


inanzzz@inanzzz:~/project$ git status
On branch develop
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

deleted: src/AppBundle/AppBundle.php

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: app/config/routing.yml

Untracked files:
(use "git add <file>..." to include in what will be committed)

src/Sport/

Yanlışlıkla dosya ve klasörleri indexleyelim


inanzzz@inanzzz:~/project$ git add --all
inanzzz@inanzzz:~/project$ git status
On branch develop
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

modified: app/config/routing.yml
deleted: src/AppBundle/AppBundle.php
new file: DefaultController.php

İndexleme işlemeni geri alalım


Aşağıdaki işlem git reset tüm dosyalar içindir ama isterseniz tek bir dosya için git reset dosyanın-ismi komutunu kullanabilirsiniz.


inanzzz@inanzzz:~/project$ git reset
Unstaged changes after reset:
M app/config/routing.yml
D src/AppBundle/AppBundle.php
D src/AppBundle/Controller/DefaultController.php
inanzzz@inanzzz:~/project$ git status
On branch develop
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: app/config/routing.yml
deleted: src/AppBundle/AppBundle.php
deleted: src/AppBundle/Controller/DefaultController.php

Untracked files:
(use "git add <file>..." to include in what will be committed)

src/Sport/

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