• sushibowl@feddit.nl
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    1 year ago

    A git branch is just a pointer to a commit, it really doesn’t correspond to what we’d naturally think of as a branch in the context of a physical tree or even in a graph.

    But as the article points out, a commit includes all of its ancestors. Therefore pointing to a commit effectively is equivalent to a branch in the context of a tree.

    Some other version control systems like mercurial have both a branch in a more intuitive sense (commits have a branch as a bit of metadata), as well as pointers to commits (mercurial, for example, calls them bookmarks).

    I mean, git has bookmarks too, they’re called tags.

    • Pipoca@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      What happens after you merge a feature branch into main and delete it? What happens to the branch?

      Afterwords, what git commands can you run to see what commits were made as part of the feature branch and which were previously on main?

      Mercurial bookmarks correspond to git branches, while mercurial tags correspond to git tags.