Story time…

  • @Buttons
    link
    English
    1
    edit-2
    4 months ago

    Every commit lists one or more parents, possibly several parents, like 8 parents. These commits thus form a graph structure.

    Branches and labels are just references to commits in this graph structure; they are commit alias, just a name that references a specific commit. Branches and tags are the same, except by convention the CLI will move branches when you commit to a branch, but tags are not moved by the CLI.

    (Commits may have many names, they have their commit ID, and they may also be named by a branch or tag. Commit IDs are hashes of the contents of the commit. This ensures, cryptographically, that a commit and it’s ID can never change.)

    Git never deletes a commit that is less than 90 days old. If you commit something, rest assured your work is in there somewhere, it’s just that no mortal being may be able to find it. Deleting a branch removes a reference to a commit, but the commits in the branch are still there. The GUI tools usually hide commits that are not part of a branch, but you can see them using “reflog” related commands.

    • TechNom (nobody)
      link
      English
      34 months ago

      possibly several parents, like 8 parents

      Fun fact. Such merges with more than 2 parents are called ‘octopus merges’. The Linux repo has a single merge with 66 parents that Torvalds named the ‘Cthulhu merge’.

      Git never deletes a commit that is less than 90 days old.

      On its own, that is. Not if you do a git gc.

      Deleting a branch removes a reference to a commit, but the commits in the branch are still there.

      but you can see them using “reflog” related commands

      Reflog - one of the most underrated git commands that has the potential to save your life some day. At least one team member must learn it.