git equivalent of 'hg share'?

If I'm understanding the documentation for hg share, the closest Git equivalent would be git worktree, a new feature in version 2.5:

Manage multiple working trees attached to the same repository.

A git repository can support multiple working trees, allowing you to check out more than one branch at a time. With git worktree add a new working tree is associated with the repository. This new working tree is called a "linked working tree" as opposed to the "main working tree" prepared by "git init" or "git clone". A repository has one main working tree (if it’s not a bare repository) and zero or more linked working trees.

I believe it's still in beta, and there is an explicit warning not to use it with submodules.

Running git worktree add ../some/path/ branch from a repository creates a new working copy with branch checked out at ../some/path/.

A longer overview of this new command can be found on GitHub's blog.

Tags:

Git

Mercurial