Reputation: 26370
I've done some commits at my repository that I want to remove. I've come back to the commit which I want to preserve:
$ git checkout commit_hash_num
How should I proceed to remove the next commits?
Upvotes: 0
Views: 142
Reputation: 392999
just
git reset --hard commit_hash_num
Fair Warning:
Don't worry too much, though: you can always immediately go back:
git reset --hard HEAD@{1}
in case you get second thoughts with respect to those later commits. Or, maybe:
git checkout -v save_wrong_commits_branch HEAD@{1}
to get back the dropped commits on a spearate branch with an apt name :/
Upvotes: 3