How can i remove detached commits from git?

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.

  • How to reset a remote GIT repository to remove all commits?
  • Show Git version in R Code
  • Why is the git command to switch branches named “git checkout”?
  • Search for string in dangling commits in Git
  • Add svn repo to existing git repo?
  • Is there a way to do a really SPARSE checkout for git?
  • Delete all branches that are more than X days/weeks old
  • How to install a plugin from github?
  • GitHub Contribution Histograms
  • Searching checkin messages in git
  • Deploy a Symfony website with Git on OVH shared server
  • Multiple git pull in one folder containing multiple repository
  • One Solution collect form web for “How can i remove detached commits from git?”

    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.

    Git Baby is a git and github fan, let's start git clone.