Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git-worktree.md: add page #1232

Merged
merged 5 commits into from
Jan 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions pages/common/git-worktree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# git worktree

> Manage multiple working trees attached to the same repository.

- Create a new folder with the specified branch checked out into it:

`git worktree add {{path/to/folder}} {{branch}}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the inconsistency of options order in your 1st and 3rd examples.

First one has add {{folder}} {{branch}}
Third has add -b {{branch}} {{folder}}

Also, please reorder the examples to have the add commands first and then the list command.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better to have them grouped by type of command, or listed in order of most commonly used to least commonly used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding prune option is a good idea. What are your thoughts on:

- Remove a worktree: 

`rm -rf {path/to/folder}} && git worktree prune`

vs

- Remove a worktree (after deleting worktree folder): 

`git worktree prune`

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better to have them grouped by type of command, or listed in order of most commonly used to least commonly used?

The options should be ordered by the workflow. Usually we cite the most simple ones first, then slowly add complexity, building up on previous examples. In this case, we should put add first, then list and prune at last.

What are your thoughts on:

I like the 2nd one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, we should put add first, then list and prune at last.

I think he was asking whether add -b should be grouped with plain add, or moved down for being a less common example. I think this call is often subjective so there isn't a single answer, but in this case I'd say it makes more sense for both add examples to be together.


- Create a new folder with a new branch checked out into it:

`git worktree add {{path/to/folder}} -b {{new_branch}}`

- List all the working directories attached to this repository:

`git worktree list`

- Remove a worktree (after deleting worktree folder):

`git worktree prune`