GIT multiple local checkouts

前端 未结 1 998
孤独总比滥情好
孤独总比滥情好 2021-01-05 11:47

I want to checkout multiple branches of the same git repostiory on the same Computer (Linux and Windows). However as the repository might be huge, I would prefer to have the

相关标签:
1条回答
  • 2021-01-05 12:26

    It is possible since Git 2.5 and its git worktree command.

    It 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).

    Once you have cloned a repo (in a folder like /path/to/myrepo), you can add worktrees for different branches in different independent paths (/path/to/br1, /path/to/br2), while having those working trees linked to the main repo history (no need to use a --git-dir option anymore)

    See "Multiple working directories with Git?"

    0 讨论(0)
提交回复
热议问题