What would I use git-worktree for?

前端 未结 10 1191
不知归路
不知归路 2020-11-27 10:18

I read Github\'s post on git-worktree. They write:

Suppose you\'re working in a Git repository on a branch called feature, when a user re

10条回答
  •  时光说笑
    2020-11-27 10:39

    I originally stumbled on this question after wondering what these fancy worktrees could be used for. Since then I have integrated them into my workflow and in spite of my initial scepticism I have come to find them quite useful.

    I work on a rather large code-base, which takes quite some time to compile. I usually have the current development branch on my machine along with the feature branch I am currently working on plus the master branch, which represents the current state of the live system.

    One of the biggest benefits for me is obviously that I don't have to recompile the entire thing everytime I switch branches (that is, worktrees). A nice side-effect is that I can go to the development worktree, do stuff there, change directory to the worktree for my current feature branch and then rebase it without having to pull first.

提交回复
热议问题