Yeah learned this the hard way.

  • kibiz0r@midwest.social
    link
    fedilink
    English
    arrow-up
    0
    ·
    28 days ago

    Git repository operations are (almost?) always recoverable. git reflog is your friend.

    The filesystem operations are another story. Handle with care.

      • kibiz0r@midwest.social
        link
        fedilink
        English
        arrow-up
        0
        ·
        28 days ago

        Think of it like your browser history but for Git. It’s a list of the SHAs related to your recent operations.

        And because Git is a content-addressable data store, a SHA is basically like a URL. Even if a branch no longer exists, if you know the SHA it pointed to then you can still check out the exact contents of that branch. The reflog helps you find that.