aboutsummaryrefslogtreecommitdiff
path: root/Documentation/git-worktree.txt
Commit message (Collapse)AuthorAge
* Documentation/git-worktree.txt: add missing `Ralf Thielow2018-01-11
| | | | | Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* add worktree.guessRemote config optionThomas Gummerer2017-12-06
| | | | | | | | | | | | Some users might want to have the --guess-remote option introduced in the previous commit on by default, so they don't have to type it out every time they create a new worktree. Add a config option worktree.guessRemote that allows users to configure the default behaviour for themselves. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: add --guess-remote flag to add subcommandThomas Gummerer2017-12-06
| | | | | | | | | | | | | | | | | Currently 'git worktree add <path>' creates a new branch named after the basename of the <path>, that matches the HEAD of whichever worktree we were on when calling "git worktree add <path>". It's sometimes useful to have 'git worktree add <path> behave more like the dwim machinery in 'git checkout <new-branch>', i.e. check if the new branch name, derived from the basename of the <path>, uniquely matches the branch name of a remote-tracking branch, and if so check out that branch and set the upstream to the remote-tracking branch. Add a new --guess-remote option that enables exactly that behaviour. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: make add <path> <branch> dwimThomas Gummerer2017-11-27
| | | | | | | | | | | | | | | | | Currently 'git worktree add <path> <branch>', errors out when 'branch' is not a local branch. It has no additional dwim'ing features that one might expect. Make it behave more like 'git checkout <branch>' when the branch doesn't exist locally, but a remote tracking branch uniquely matches the desired branch name, i.e. create a new branch from the remote tracking branch and set the upstream to the remote tracking branch. As 'git worktree add' currently just dies in this situation, there are no backwards compatibility worries when introducing this feature. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: add --[no-]track option to the add subcommandThomas Gummerer2017-11-27
| | | | | | | | | | | | | | | | Currently 'git worktree add' sets up tracking branches if '<branch>' is a remote tracking branch, and doesn't set them up otherwise, as is the default for 'git branch'. This may or may not be what the user wants. Allow overriding this behaviour with a --[no-]track flag that gets passed through to 'git branch'. We already respect branch.autoSetupMerge, as 'git worktree' just calls 'git branch' internally. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: add can be created from any commit-ishThomas Gummerer2017-11-27
| | | | | | | | | | | | | | Currently 'git worktree add' is documented to take an optional <branch> argument, which is checked out in the new worktree. However it is more generally possible to use a commit-ish as the optional argument, and check that out into the new worktree. Document that this is a possibility, as new users of git worktree add might find it helpful. Reported-by: Randall S. Becker <rsbecker@nexbridge.com> Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree add: add --lock optionNguyễn Thái Ngọc Duy2017-04-20
| | | | | | | | | | | | | | | As explained in the document. This option has an advantage over the command sequence "git worktree add && git worktree lock": there will be no gap that somebody can accidentally "prune" the new worktree (or soon, explicitly "worktree remove" it). "worktree add" does keep a lock on while it's preparing the worktree. If --lock is specified, this lock remains after the worktree is created. Suggested-by: David Taylor <David.Taylor@dell.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'bc/worktree-doc-fix-detached'Junio C Hamano2017-02-24
|\ | | | | | | | | | | | | Doc update. * bc/worktree-doc-fix-detached: Documentation: correctly spell git worktree --detach
| * Documentation: correctly spell git worktree --detachbrian m. carlson2017-02-22
| | | | | | | | | | | | | | | | | | The option is “--detach”, but we accidentally spelled it “--detached” at one point in the man page. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Reported-by: Casey Rodarmor <casey@rodarmor.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'nd/worktree-lock'Junio C Hamano2016-11-17
|\ \ | | | | | | | | | | | | | | | | | | Typofix. * nd/worktree-lock: git-worktree.txt: fix typo "to"/"two", and add comma
| * | git-worktree.txt: fix typo "to"/"two", and add commaBen North2016-11-13
| | | | | | | | | | | | | | | Signed-off-by: Ben North <ben@redfrontdoor.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'nd/worktree-lock'Junio C Hamano2016-07-28
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "git worktree prune" protected worktrees that are marked as "locked" by creating a file in a known location. "git worktree" command learned a dedicated command pair to create and remove such a file, so that the users do not have to do this with editor. * nd/worktree-lock: worktree.c: find_worktree() search by path suffix worktree: add "unlock" command worktree: add "lock" command worktree.c: add is_worktree_locked() worktree.c: add is_main_worktree() worktree.c: add find_worktree()
| * | worktree.c: find_worktree() search by path suffixNguyễn Thái Ngọc Duy2016-07-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the user to do something like "worktree lock foo" or "worktree lock to/foo" instead of "worktree lock /long/path/to/foo" if it's unambiguous. With completion support it could be quite convenient. While this base name search can be done in the same worktree iteration loop, the code is split into a separate function for clarity. Suggested-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | worktree: add "unlock" commandNguyễn Thái Ngọc Duy2016-07-08
| | | | | | | | | | | | | | | Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | worktree: add "lock" commandNguyễn Thái Ngọc Duy2016-07-08
| | | | | | | | | | | | | | | | | | Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'nd/worktree-cleanup-post-head-protection'Junio C Hamano2016-07-06
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Further preparatory clean-up for "worktree" feature continues. * nd/worktree-cleanup-post-head-protection: worktree: simplify prefixing paths worktree: avoid 0{40}, too many zeroes, hard to read worktree.c: use is_dot_or_dotdot() git-worktree.txt: keep subcommand listing in alphabetical order worktree.c: rewrite mark_current_worktree() to avoid strbuf completion: support git-worktree
| * | git-worktree.txt: keep subcommand listing in alphabetical orderNguyễn Thái Ngọc Duy2016-05-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is probably not the best order. But it makes it no-brainer to know where to insert new commands. At some point we might want to reorder at least the synopsis part again, grouping commonly use subcommands together. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Reviewed-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | worktree: allow "-" short-hand for @{-1} in add commandJordan DE GEA2016-05-31
|/ / | | | | | | | | | | | | | | | | | | Since `git worktree add` uses `git checkout` when `[<branch>]` is used, and `git checkout -` is already supported, it makes sense to allow the same shortcut in `git worktree add`. Signed-off-by: Jordan DE GEA <jordan.de-gea@grenoble-inp.org> Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | worktree: add: introduce --checkout optionRay Zhang2016-03-29
| | | | | | | | | | | | | | | | | | | | | | | | By adding this option which defaults to true, we can use the corresponding --no-checkout to make some customizations before the checkout, like sparse checkout, etc. Helped-by: Eric Sunshine <sunshine@sunshineco.com> Helped-by: Junio C Hamano <gitster@pobox.com> Reviewed-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Ray Zhang <zhanglei002@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | worktree: stop supporting moving worktrees manuallyNguyễn Thái Ngọc Duy2016-01-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current update_linked_gitdir() has a bug that can create "gitdir" file in non-multi-worktree setup. Worse, sometimes it can write relative path to "gitdir" file, which will not work (e.g. "git worktree list" will display the worktree's location incorrectly) Instead of fixing this, we step back a bit. The original design was probably not well thought out. For now, if the user manually moves a worktree, they have to fix up "gitdir" file manually or the worktree will get pruned. Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | worktree: add 'list' commandMichael Rappazzo2015-10-08
| | | | | | | | | | | | | | | | | | | | 'git worktree list' iterates through the worktree list, and outputs details of the worktree including the path to the worktree, the currently checked out revision and branch, and if the work tree is bare. There is also porcelain format option available. Signed-off-by: Michael Rappazzo <rappazzo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Documentation/git-worktree: fix duplicated 'from'Patrick Steinhardt2015-08-05
| | | | | | | | | | | | Signed-off-by: Patrick Steinhardt <ps@pks.im> Acked-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Documentation/git-worktree: fix broken 'linkgit' invocationEric Sunshine2015-07-24
|/ | | | | Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: add: suppress auto-vivication with --detach and no <branch>Eric Sunshine2015-07-20
| | | | | | | | | | | | | | Fix oversight where branch auto-vivication incorrectly kicks in when --detach is specified and <branch> omitted. Instead, treat: git worktree add --detach <path> as shorthand for: git worktree add --detach <path> HEAD Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* config: rename "gc.pruneWorktreesExpire" to "gc.worktreePruneExpire"Eric Sunshine2015-07-20
| | | | | | | | | | As of df0b6cf (worktree: new place for "git prune --worktrees", 2015-06-29), linked worktree pruning functionality moved from "git prune --worktrees" to "git worktree prune". Rename the associated configuration variable accordingly. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Documentation/git-worktree: fix incorrect reference to file "locked"Michael Haggerty2015-07-20
| | | | | | | | | | | The administrative file to suppress pruning is named "locked", not "lock". [es: don't touch unrelated "git worktree lock" command; reword commit message] Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Documentation/git-worktree: consistently use term "linked working tree"Michael Haggerty2015-07-20
| | | | | | | | | | | | Sometimes linked working trees were called "linked working directories" or "linked worktrees". Always refer to them as "linked working trees" for consistency. [es: fix additional occurrences] Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: caution that this is still experimentalJunio C Hamano2015-07-16
| | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Documentation/git-worktree: fix stale "git checkout --to" referencesEric Sunshine2015-07-16
| | | | | | | | These should have been changed to "git worktree add" by fc56361 (worktree: introduce "add" command, 2015-07-06. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: add: auto-vivify new branch when <branch> is omittedEric Sunshine2015-07-07
| | | | | | | | | | | As a convenience, when <branch> is omitted from "git worktree <path> <branch>" and neither -b nor -B is used, automatically create a new branch named after <path>, as if "-b $(basename <path>)" was specified. Thus, "git worktree add ../hotfix" creates a new branch named "hotfix" and associates it with new worktree "../hotfix". Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: add: make -b/-B default to HEAD when <branch> is omittedEric Sunshine2015-07-06
| | | | | | | | | As a convenience, like "git branch" and "git checkout -b", make "git worktree add -b <newbranch> <path> <branch>" default to HEAD when <branch> is omitted. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: add -b/-B optionsEric Sunshine2015-07-06
| | | | | | | | | | | | One of git-worktree's roles is to populate the new worktree, much like git-checkout, and thus, for convenience, ought to support several of the same shortcuts. Toward this goal, add -b/-B options to create a new branch and check it out in the new worktree. (For brevity, only -b is mentioned in the synopsis; -B is omitted.) Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: add --detach optionEric Sunshine2015-07-06
| | | | | | | | | | One of git-worktree's roles is to populate the new worktree, much like git-checkout, and thus, for convenience, ought to support several of the same shortcuts. Toward this goal, add a --detach option to detach HEAD in the new worktree. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: add --force optionEric Sunshine2015-07-06
| | | | | | | | | By default, "git worktree add" refuses to create a new worktree when the requested branch is already checked out elsewhere. Add a --force option to override this safeguard. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: introduce "add" commandEric Sunshine2015-07-06
| | | | | | | | | | | | The plan is to relocate "git checkout --to" functionality to "git worktree add". As a first step, introduce a bare-bones git-worktree "add" command along with documentation. At this stage, "git worktree add" merely invokes "git checkout --to" behind the scenes, but an upcoming patch will move the actual functionality (checkout.c:prepare_linked_checkout() and its helpers) to worktree.c. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Documentation/git-worktree: add EXAMPLES sectionEric Sunshine2015-07-06
| | | | | Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Documentation/git-worktree: add high-level 'lock' overviewEric Sunshine2015-07-06
| | | | | | | | | | | | Due to the (current) absence of a "git worktree lock" command, locking a worktree's administrative files to prevent automatic pruning is a manual task, necessarily requiring low-level understanding of linked worktree functionality. However, this level of detail does not belong in the high-level DESCRIPTION section, so add a generalized discussion of locking to DESCRIPTION and move the technical information to DETAILS. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Documentation/git-worktree: split technical info from general descriptionEric Sunshine2015-07-06
| | | | | | | | | | The DESCRIPTION section should provide a high-level overview of linked worktree functionality to bring users up to speed quickly, without overloading them with low-level details, so relocate the technical information to a new DETAILS section. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Documentation/git-worktree: add BUGS sectionEric Sunshine2015-07-06
| | | | | | | Relocate submodule warning to BUGS and enumerate missing commands. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Documentation: move linked worktree description from checkout to worktreeEric Sunshine2015-07-06
| | | | | | | | | | Now that the git-worktree command exists, its documentation page is the natural place for the linked worktree description to reside. Relocate the "MULTIPLE WORKING TREES" description verbatim from git-checkout.txt to git-worktree.txt. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Documentation/git-worktree: associate options with commandsEric Sunshine2015-07-06
| | | | | | | | | | git-worktree options affect some worktree commands but not others, but this is not necessarily obvious from the option descriptions. Make this clear by indicating explicitly which commands are affected by which options. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: new place for "git prune --worktrees"Nguyễn Thái Ngọc Duy2015-06-29
Commit 23af91d (prune: strategies for linked checkouts - 2014-11-30) adds "--worktrees" to "git prune" without realizing that "git prune" is for object database only. This patch moves the same functionality to a new command "git worktree". Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>