Reputation: 1889
I would like to delete the commit 9dfd73, the one highlighted. As you can see it's not a branch. It's the result of a detached head.
I tried to make a branch on it and then delete that branch using git branch -D 9dfd73, but that deleted the branch, leaving the commit.
Any ideas?
UPDATE:
For some reason, that commit doesn't exit in my tree any more, and I didn't have the chance to try your solution.
But I'll mark it as the correct answer if you can explain what does that command really does :-)
git rebase --onto <9dfd73>^ <9dfd73> HEAD
I understand it's something like: "take all the commits between the commit 9dfd73 and HEAD (excluding HEAD itself) and put them on top of the commit 9dfd73"
But I don't understand the ^ symbol.
Also, I'm not sure if the ID should be the same. Could you explain further?
Thank you
Upvotes: 1
Views: 196
Reputation: 70225
If you insist on getting rid of it/them now, follow these instructions. But, dont' worry about it; it will eventually disappear on their own.
Upvotes: 0
Reputation: 8138
You should try the file > reload menu in gitk (ctrl-F5). This will probably make your commit disappear, since it is not the current commit anymore and it is not on any branch.
Upvotes: 1
Reputation: 32488
Use the following command,
git rebase --onto <commit-id>^ <commit-id> HEAD
commit-id will be your SHA-1 id
Upvotes: 1