• HaraldvonBlauzahn@feddit.orgOP
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    21 hours ago

    One difference between using worktrees and branches in git is that in git you usually have uncommited stuff that’s not finished, and worktrees are a way to avoid committing this. And you want to avoid committing early because it is hard to clean-up later. This hesistsnce to commit is not necessary at all in jujutsu - any change to the source files is already captured and will be restored once you go back to that changeset. There are other cases where you use worktrees in git e.g. to isolate a build and an hour-long integration test running it in parallel to your ongoing work, and in thar cases, you’d use workspaces in jujutsu like you’d in git.

    but then we would need to talk about what about the git model people have trouble with, why

    Too many commands that do subtly and irreversivly things on the repo, with potentially messed-up interim states, only to do the conceptually much simpler task to edit and manipulate the directed acyclic graph of commits.

    In short, jujutsu is a commit graph editor and does the same with perhaps 10% of the complexity of git. The man pages on the git reset, branch and merge commands are already larger than the whole - and detailed!- documentation of jujutsu.

    Steve Klabnik explains this much better than I can here in his blog that I posted.

    • ugo@feddit.it
      link
      fedilink
      arrow-up
      2
      arrow-down
      1
      ·
      19 hours ago

      It is simply not my experience that cleaning up commits after committing early is difficult in git. Amending a commit is a single -a flag away from the git commit command. The opposite problem is when you do too much work and want to split it into multiple commit rather than a huge one, in which case git add -p is again a single flag away from git add.

      In general, git’s entire model is to allow you to work first, and do administrative tasks (including tidying up your commit history etc) later.

      And almost nothing is truly destructive in git, the vast majority of cases can be fixed by judicious use of git reflog.

      The only cases I’ve ran into where git repos became corrupted were caused by external tools, mainly GUIs that label buttons with git commands that do something different when clicked (like the button labeled push actually doing git push —all for no good reason, and such things) with users that have no idea how git works that have been trained just by telling them “click this to save your work, click this to get the last version of the code”

      • HaraldvonBlauzahn@feddit.orgOP
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        13 hours ago

        I have to admit that in spite of having used git for about 20 years, I never used reflog. And even with magit I did stuff like rebase rarely. I found it costing too much time to read the man pages again every time and meditate what would happen with “reset xyz”.

        • ugo@feddit.it
          link
          fedilink
          arrow-up
          1
          arrow-down
          1
          ·
          13 hours ago

          Fair, git’s documentation can definitely be too terse despite being very extensive and could really benefit from examples and common use cases sections. I only use a fraction of what git offers, but what I do use I use often, which definitely contributes to my happiness with git: I seldomly need to look things up

          • HaraldvonBlauzahn@feddit.orgOP
            link
            fedilink
            arrow-up
            1
            ·
            8 hours ago

            Now, jujutsu covers almost the same with < 10% of that complexity and less than 10% of the documentation - simpler but the same power.