Remove commit for good

前端 未结 2 1916
醉话见心
醉话见心 2020-12-18 12:42

I know there are thousands of threads for this question.

But I found out something really weird.

If you create a project on GitHub, do some commits.
Let\

2条回答
  •  情书的邮戳
    2020-12-18 13:05

    According to your additional comments :

    You did everything as it should be.
    The point is this: git never lose data unless you tell it to (whats known as gc - garbadge collector)

    The files will remain there until they will gc will be called.

    This is called dangling file

    Dangling commit

    A commit that isn't linked to any branch or tag either directly or by any of its ascendants.

    You can see all the dangling references locally with this:

    git fsck --full
    

    The only way to get rid of it is to run gc

    //
    // !!!Caution:
    // It will remove all your dangling files
    git gc --aggressive --prune now
    

    Here you can read some more about it.

提交回复
热议问题