How to work simultaneously on a few branches

前端 未结 4 1795
没有蜡笔的小新
没有蜡笔的小新 2021-01-30 06:40

This is a follow-up on this question on creating branches.

It strikes me as odd that I would still work on one repository because the files on my local machine will be a

4条回答
  •  无人及你
    2021-01-30 07:01

    With Git 2.5+ (Q2 2015), Git is no longer designed to work within a single folder (ie a single working tree)

    Git will support multiple working trees (for one cloned git repo) with the new command git worktree add [].

    That replaces an older script contrib/workdir/git-new-workdir, with a more robust mechanism where those "linked" working trees are actually recorded in the main repo new $GIT_DIR/worktrees folder (so that work on any OS, including Windows).

    You will be able to checkout different branches in different path while being part of the same main cloned repo.

    See more at "Multiple working directories with Git?"

提交回复
热议问题