Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i remove detached commits from git?

Tags:

git

github

I have two detached commits. How can i remove they as if they had never been? I don't want save history or another logs. Nothing.

like image 323
Akuma Avatar asked Dec 18 '13 18:12

Akuma


1 Answers

Do you mean commits made while you had a detached HEAD? If so, just:

git checkout some_branch

Your commits will no longer be visible in e.g. git log. They will be culled from storage at some point while Git runs its garbage-collection sweeps. If you want to cull things now, see answers to this question: How to remove unreferenced blobs from my git repo.

like image 110
Oliver Charlesworth Avatar answered Nov 11 '22 18:11

Oliver Charlesworth