14/03/2015 - GIT
Sadece bir commit geriye gidip tüp yaptıklarınızı silmek istiyorsunuz. Bu iş için git reset --hard HEAD~1
veya git reset --hard <git-idyi-buraya-yapıştır>
command. Daha fazla bilgi için git reset linkini tıklayın.
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")
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
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
Commit "db8957fb94f9a32bca1ae57d4e6ed8340efb9c6b" commit listesinden kalkacak.
inanzzz@inanzzz:~/project$ git reset --hard HEAD~1
veya
inanzzz@inanzzz:~/project$ git reset --hard 2ed26e52092851f40ea4fec60d357cd138f04209
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
Göründüğü gibi her şey silindi.
inanzzz@inanzzz:~/project$ git status
On branch branch-one
nothing to commit, working directory clean