Skip to content

Add git worktree command [was: hg share -> git worktree] #105

Closed
@tiran

Description

@tiran

I used hg share a lot to share a single hg clone between multiple working directories. It's convenient to have a lean copy for each branch of Python (2.7, 3.5, 3.6). git has a similar feature called worktree, https://git-scm.com/docs/git-worktree . It took me a bit to find it. Other developers may find the feature useful, too. What do you think about documenting git worktree in the dev guide?

$ git clone git@github.com:python/cpython.git
$ git remote rename origin upstream
$ git worktree add -b 2.7 ../2.7 upstream/2.7
$ git worktree add -b 3.5 ../3.5 upstream/3.5
$ git worktree add -b 3.6 ../3.6 upstream/3.6
$ git worktree list
/tmp/cpython  e7ffb99 [master]
/tmp/3.6      2a35c93 [3.6]
/tmp/3.5      9cd7e17 [3.5]
/tmp/2.7      5c32988 [2.7]

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions