Sadece bir commit geriye gidip, eksik yaptığınız işi tamamlamak istiyorsunuz. Aynı zamanda yapılan işlerin kaybolmamasını istiyorsunuz. Bu iş için git reset --soft HEAD~1 veya git reset --soft <git-idyi-buraya-yapıştır> command. Daha fazla bilgi için git reset linkini tıklayın.


Mevcut durumu kontrol edin


inanzzz@inanzzz:~/project$ git status
On branch branch-one
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: file_five.txt
modified: file_four.txt

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

file_eight.txt

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

Commit


inanzzz@inanzzz:~/project$ git add --all
inanzzz@inanzzz:~/project$ git commit -m 'Second commit in branch-one branch'
[branch-one db8957f] Second commit in branch-one branch
3 files changed, 2 insertions(+)
create mode 100644 file_eight.txt

Bir önceki commitlerinizi listeleyin


inanzzz@inanzzz:~/project$ git log
commit db8957fb94f9a32bca1ae57d4e6ed8340efb9c6b
Author: inanzzz
Date: Sat Mar 14 11:41:31 2015 +0000

Second commit in branch-one branch

commit 2ed26e52092851f40ea4fec60d357cd138f04209
Author: inanzzz
Date: Sat Mar 14 11:40:05 2015 +0000

First commit in branch-one branch

commit 1c5d63e1a8296bffbdda34863a91851ec3fcb665
Author: inanzzz
Date: Sat Mar 14 11:38:48 2015 +0000

Second commit in develop branch

commit f2af40db65826acd4606986acc1a9738297b1efb
Author: inanzzz
Date: Sat Mar 14 11:37:32 2015 +0000

First commit in develop branch

Son commiti geri al


Commit "db8957fb94f9a32bca1ae57d4e6ed8340efb9c6b" commit listesinden kalkacak.


inanzzz@inanzzz:~/project$ git reset --soft HEAD~1

veya


inanzzz@inanzzz:~/project$ git reset --soft 2ed26e52092851f40ea4fec60d357cd138f04209

Bir önceki commitlerinizi listeleyin


inanzzz@inanzzz:~/project$ git log
commit 2ed26e52092851f40ea4fec60d357cd138f04209
Author: inanzzz
Date: Sat Mar 14 11:40:05 2015 +0000

First commit in branch-one branch

commit 1c5d63e1a8296bffbdda34863a91851ec3fcb665
Author: inanzzz
Date: Sat Mar 14 11:38:48 2015 +0000

Second commit in develop branch

commit f2af40db65826acd4606986acc1a9738297b1efb
Author: inanzzz
Date: Sat Mar 14 11:37:32 2015 +0000

First commit in develop branch

Mevcut durumu kontrol edin


Göründüğü gibi her şey geri geldi.


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

new file: file_eight.txt
modified: file_five.txt
modified: file_four.txt