0

I worked on an experimental branch and now want to delete it. Running git branch -d experimental outputs

error: The branch 'experimental' is not fully merged.
If you are sure you want to delete it, run 'git branch -D experimental'.

After running deleting the branch with -D, what happens to the commits left behind?

John Oxley
  • 14,698
  • 18
  • 53
  • 78
  • 2
    possible duplicate of [Can I recover branch after the deletion in git?](http://stackoverflow.com/questions/3640764/can-i-recover-branch-after-the-deletion-in-git) – Oliver Charlesworth Oct 01 '14 at 09:45

1 Answers1

1

They stay where they are in the git graph, simply there's no explicit reference to them anymore.

If you have the hash of a specific commit in that branch you can still refer to it, try for instance

git log <commit-sha>

where <commit-sha> is the hash of the commit.

That being said, also note that those "dangling" commits may disappear in the future when someone runs git prune (directly or via git gc, which in modern versions of git is run automatically when needed), which deletes all the unreachable objects from the graph.

Gabriele Petronella
  • 106,943
  • 21
  • 217
  • 235