git - move back to previous commit and delete current commit I am on -
i have following commits:
$ git log --pretty=oneline ba69c7a4c4a642549e70319ccb1f7904893d6df1 ko added currentcat , works 63e61d861923694944084e47ed613385d329a36a ko added seperate cat function ad8be8da63e0381dfeb4a1db108021dd294b0556 init $
i want move 2nd commit 63e6
, delete ba69
commit. how do this?
for reference:
how show commit on:
$ git rev-parse head ba69c7a4c4a642549e70319ccb1f7904893d6df1 $ git show | head -n 5 commit ba69c7a4c4a642549e70319ccb1f7904893d6df1 author: name <you@example.com> date: wed feb 3 14:02:32 2016 +1300 ko added currentcat , works
edit1 per below comment, reset , commited again, can seen in git reflog
$ git reflog 9522fd7 head@{0}: commit: ko add iterate through currentcat 63e61d8 head@{1}: reset: moving 63e61 ba69c7a head@{2}: commit: ko added currentcat , works 63e61d8 head@{3}: commit: ko added seperate cat function ad8be8d head@{4}: clone: https://github.com/hattricknz/ud989-cat-clicker-ko-starter
after git reset --hard <commit>
, git push -f origin
force push , permanently delete commit repository history.
if want keep commit in repo history, use git revert <commit>
revert commit don't want.
Comments
Post a Comment