In short you can attach multiple worktrees to the same git repository with "git checkout --to <somewhere>". This is basically what git-new-workdir is for. Previous discussion here http://thread.gmane.org/gmane.comp.version-control.git/239194/focus=239581 Compared to last time: - .git file format remains unchanged. It was a stupid idea to tie $GIT_COMMON_DIR pointer to .git file because you will have to pass that info another way if you don't go through .git file. Now it's stored in $GIT_DIR/commondir - Last time, checking out an already checked out branch will detach the previous checkout. Junio wanted to error out for less user confusion. I go with a (good, imo) compromise in this reroll: the new checkout detaches itself in this case, hinting where the branch is truly checked out so the user can go there and do things Nguyễn Thái Ngọc Duy (25): path.c: make get_pathname() return strbuf instead of static buffer Convert git_snpath() to strbuf_git_path() path.c: rename vsnpath() to do_git_path() path.c: group git_path(), git_pathdup() and strbuf_git_path() together Make git_path() aware of file relocation in $GIT_DIR *.sh: respect $GIT_INDEX_FILE reflog: avoid constructing .lock path with git_path fast-import: use git_path() for accessing .git dir instead of get_git_dir() commit: use SEQ_DIR instead of hardcoding "sequencer" Add new environment variable $GIT_COMMON_DIR git-sh-setup.sh: use rev-parse --git-path to get $GIT_DIR/objects *.sh: avoid hardcoding $GIT_DIR/hooks/... git-stash: avoid hardcoding $GIT_DIR/logs/.... setup.c: convert is_git_directory() to use strbuf setup.c: detect $GIT_COMMON_DIR in is_git_directory() setup.c: convert check_repository_format_gently to use strbuf setup.c: detect $GIT_COMMON_DIR check_repository_format_gently() setup.c: support multi-checkout repo setup wrapper.c: wrapper to open a file, fprintf then close use new wrapper write_file() for simple file writing checkout: support checking out into a new working directory checkout: clean up half-prepared directories in --to mode checkout: detach if the branch is already checked out elsewhere prune: strategies for linked checkouts gc: support prune --repos Documentation/config.txt | 9 +- Documentation/git-checkout.txt | 34 +++++ Documentation/git-prune.txt | 3 + Documentation/git-rev-parse.txt | 8 + Documentation/git.txt | 8 + Documentation/gitrepository-layout.txt | 26 ++++ builtin/branch.c | 4 +- builtin/checkout.c | 272 +++++++++++++++++++++++++++++++-- builtin/commit.c | 2 +- builtin/gc.c | 17 +++ builtin/init-db.c | 7 +- builtin/prune.c | 75 +++++++++ builtin/reflog.c | 2 +- builtin/rev-parse.c | 11 ++ cache.h | 10 +- daemon.c | 11 +- environment.c | 24 ++- fast-import.c | 5 +- git-am.sh | 22 +-- git-pull.sh | 2 +- git-rebase--interactive.sh | 6 +- git-rebase--merge.sh | 6 +- git-rebase.sh | 4 +- git-sh-setup.sh | 2 +- git-stash.sh | 6 +- path.c | 201 +++++++++++++++--------- refs.c | 66 +++++--- refs.h | 2 +- setup.c | 117 ++++++++++---- strbuf.c | 8 + strbuf.h | 5 + submodule.c | 9 +- t/t0060-path-utils.sh | 34 +++++ t/t1501-worktree.sh | 76 +++++++++ t/t1510-repo-setup.sh | 1 + t/t2025-checkout-to.sh (new +x) | 48 ++++++ templates/hooks--applypatch-msg.sample | 4 +- templates/hooks--pre-applypatch.sample | 4 +- trace.c | 1 + transport.c | 8 +- wrapper.c | 31 ++++ 41 files changed, 976 insertions(+), 215 deletions(-) create mode 100755 t/t2025-checkout-to.sh -- 1.8.5.2.240.g8478abd -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html