• atzanteol@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    8
    ·
    17 days ago

    As somebody who rarely has a “pristine” working copy I love worktrees. I usually have a “project-master” worktree that’s a pristine checkout of the master branch so I can test builds and things without interference from uncommitted and temporary files.

    • Dessalines@lemmy.mlOP
      link
      fedilink
      arrow-up
      5
      ·
      17 days ago

      Same. The main thing I’ve been liking about it for the slower compiling languages that I mainly work in (rust, android jetpack compose), is that it leaves the build or target directories in place. So instead of git checkout && clean_build_dir, and having to wait to recompile, I can just cd to that dir.

    • Tanoh@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      17 days ago

      I usually just check out another copy in another directory, say I am working on Foo. foo/ is the dev playground and clean-foo/ for a clean checkout from master.

      I know you can do it all with commands but I just find it easier to diff between directories or check how things are in master without touching the dev dir.

      • atzanteol@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        1
        ·
        17 days ago

        When you do that you can’t compare branches in the same working copy in different directories. You need to create remotes between the two working copies and push/pull between them.

        e.g. “git log --graph …my-branch” or “git diff my-branch master” where my-branch and master are in different directories.