<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/Documentation/git-worktree.txt, branch v2.19.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.19.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.19.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2018-10-23T03:23:08Z</updated>
<entry>
<title>doc: clarify boundaries of 'git worktree list --porcelain'</title>
<updated>2018-10-23T03:23:08Z</updated>
<author>
<name>Andreas Heiduk</name>
<email>asheiduk@gmail.com</email>
</author>
<published>2018-10-22T20:45:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e44a44aa25c5ff22334efe0bd4187b96303b00fd'/>
<id>urn:sha1:e44a44aa25c5ff22334efe0bd4187b96303b00fd</id>
<content type='text'>
Defined delimiters for 'git worktree list --porcelain' make the format
easier to parse in scripts. For example

	sed -n '/^worktree ID$/,/^$/p'

extracts only the information for the worktree 'ID'.

The format did not changed since [1], only the guaranty is added.

[1] bb9c03b82a (worktree: add 'list' command, 2015-10-08)

Signed-off-by: Andreas Heiduk &lt;asheiduk@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>worktree: add --quiet option</title>
<updated>2018-08-17T22:18:01Z</updated>
<author>
<name>Elia Pinto</name>
<email>gitter.spiros@gmail.com</email>
</author>
<published>2018-08-15T20:56:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=371979c21745a8be34a556e663d71e3a984ff4ce'/>
<id>urn:sha1:371979c21745a8be34a556e663d71e3a984ff4ce</id>
<content type='text'>
Add the '--quiet' option to git worktree, as for the other git
commands. 'add' is the only command affected by it since all other
commands, except 'list', are currently silent by default.

[jc: appiled trivial fix-up to keep the tests from touching outside
the scratch area]

Helped-by: Martin Ågren &lt;martin.agren@gmail.com&gt;
Helped-by: Duy Nguyen &lt;pclouds@gmail.com&gt;
Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Elia Pinto &lt;gitter.spiros@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>checkout &amp; worktree: introduce checkout.defaultRemote</title>
<updated>2018-06-11T16:41:02Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2018-06-05T14:40:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8d7b558baebe3abbbad4973ce1e1f87a7da17f47'/>
<id>urn:sha1:8d7b558baebe3abbbad4973ce1e1f87a7da17f47</id>
<content type='text'>
Introduce a checkout.defaultRemote setting which can be used to
designate a remote to prefer (via checkout.defaultRemote=origin) when
running e.g. "git checkout master" to mean origin/master, even though
there's other remotes that have the "master" branch.

I want this because it's very handy to use this workflow to checkout a
repository and create a topic branch, then get back to a "master" as
retrieved from upstream:

    (
        cd /tmp &amp;&amp;
        rm -rf tbdiff &amp;&amp;
        git clone git@github.com:trast/tbdiff.git &amp;&amp;
        cd tbdiff &amp;&amp;
        git branch -m topic &amp;&amp;
        git checkout master
    )

That will output:

    Branch 'master' set up to track remote branch 'master' from 'origin'.
    Switched to a new branch 'master'

But as soon as a new remote is added (e.g. just to inspect something
from someone else) the DWIMery goes away:

    (
        cd /tmp &amp;&amp;
        rm -rf tbdiff &amp;&amp;
        git clone git@github.com:trast/tbdiff.git &amp;&amp;
        cd tbdiff &amp;&amp;
        git branch -m topic &amp;&amp;
        git remote add avar git@github.com:avar/tbdiff.git &amp;&amp;
        git fetch avar &amp;&amp;
        git checkout master
    )

Will output (without the advice output added earlier in this series):

    error: pathspec 'master' did not match any file(s) known to git.

The new checkout.defaultRemote config allows me to say that whenever
that ambiguity comes up I'd like to prefer "origin", and it'll still
work as though the only remote I had was "origin".

Also adjust the advice.checkoutAmbiguousRemoteBranchName message to
mention this new config setting to the user, the full output on my
git.git is now (the last paragraph is new):

    $ ./git --exec-path=$PWD checkout master
    error: pathspec 'master' did not match any file(s) known to git.
    hint: 'master' matched more than one remote tracking branch.
    hint: We found 26 remotes with a reference that matched. So we fell back
    hint: on trying to resolve the argument as a path, but failed there too!
    hint:
    hint: If you meant to check out a remote tracking branch on, e.g. 'origin',
    hint: you can do so by fully qualifying the name with the --track option:
    hint:
    hint:     git checkout --track origin/&lt;name&gt;
    hint:
    hint: If you'd like to always have checkouts of an ambiguous &lt;name&gt; prefer
    hint: one remote, e.g. the 'origin' remote, consider setting
    hint: checkout.defaultRemote=origin in your config.

I considered splitting this into checkout.defaultRemote and
worktree.defaultRemote, but it's probably less confusing to break our
own rules that anything shared between config should live in core.*
than have two config settings, and I couldn't come up with a short
name under core.* that made sense (core.defaultRemoteForCheckout?).

See also 70c9ac2f19 ("DWIM "git checkout frotz" to "git checkout -b
frotz origin/frotz"", 2009-10-18) which introduced this DWIM feature
to begin with, and 4e85333197 ("worktree: make add &lt;path&gt; &lt;branch&gt;
dwim", 2017-11-26) which added it to git-worktree.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'tg/worktree-add-existing-branch'</title>
<updated>2018-05-23T05:38:18Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-05-23T05:38:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=10174da9f1643eb939d93d479547494baf77377b'/>
<id>urn:sha1:10174da9f1643eb939d93d479547494baf77377b</id>
<content type='text'>
"git worktree add" learned to check out an existing branch.

* tg/worktree-add-existing-branch:
  worktree: teach "add" to check out existing branches
  worktree: factor out dwim_branch function
  worktree: improve message when creating a new worktree
  worktree: remove extra members from struct add_opts
</content>
</entry>
<entry>
<title>Merge branch 'sb/worktree-remove-opt-force'</title>
<updated>2018-05-08T06:59:24Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-05-08T06:59:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=90186fa0579e4dcdde08a2d823d9b269578d5a70'/>
<id>urn:sha1:90186fa0579e4dcdde08a2d823d9b269578d5a70</id>
<content type='text'>
"git worktree remove" learned that "-f" is a shorthand for
"--force" option, just like for "git worktree add".

* sb/worktree-remove-opt-force:
  worktree: accept -f as short for --force for removal
</content>
</entry>
<entry>
<title>worktree: teach "add" to check out existing branches</title>
<updated>2018-04-30T00:06:34Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2018-04-24T21:56:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f60a7b763fe070161b332d3878f81a7f09ab6e44'/>
<id>urn:sha1:f60a7b763fe070161b332d3878f81a7f09ab6e44</id>
<content type='text'>
Currently 'git worktree add &lt;path&gt;' creates a new branch named after the
basename of the path by default.  If a branch with that name already
exists, the command refuses to do anything, unless the '--force' option
is given.

However we can do a little better than that, and check the branch out if
it is not checked out anywhere else.  This will help users who just want
to check an existing branch out into a new worktree, and save a few
keystrokes.

As the current behaviour is to simply 'die()' when a branch with the name
of the basename of the path already exists, there are no backwards
compatibility worries here.

We will still 'die()' if the branch is checked out in another worktree,
unless the --force flag is passed.

Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Reviewed-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'es/worktree-docs'</title>
<updated>2018-04-25T04:29:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-04-25T04:29:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6b747fc72399c2fed6922375fe0a290f98649acf'/>
<id>urn:sha1:6b747fc72399c2fed6922375fe0a290f98649acf</id>
<content type='text'>
Doc updates.

* es/worktree-docs:
  git-worktree.txt: unify command-line prompt in example blocks
  git-worktree.txt: recommend 'git worktree remove' over manual deletion
</content>
</entry>
<entry>
<title>worktree: accept -f as short for --force for removal</title>
<updated>2018-04-18T00:19:05Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2018-04-17T18:19:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d228eea5146540b09376f90e2b805553cdc78590'/>
<id>urn:sha1:d228eea5146540b09376f90e2b805553cdc78590</id>
<content type='text'>
Many commands support a "--force" option, frequently abbreviated as
"-f", however, "git worktree remove"'s hand-rolled OPT_BOOL forgets
to recognize the short form, despite git-worktree.txt documenting
"-f" as supported. Replace OPT_BOOL with OPT__FORCE, which provides
"-f" for free, and makes 'remove' consistent with 'add' option
parsing (which also specifies the PARSE_OPT_NOCOMPLETE flag).

Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-worktree.txt: unify command-line prompt in example blocks</title>
<updated>2018-04-09T09:49:24Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2018-04-09T07:34:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=22d11a6e8e2d0aa6f5930477c3509483dbe4545a'/>
<id>urn:sha1:22d11a6e8e2d0aa6f5930477c3509483dbe4545a</id>
<content type='text'>
The command-line prompt in the "EXAMPLES" section is "$", however,
examples in the 'git worktree list' section (oddly) use "S" as a
prompt. Fix this inconsistency by settling on "$" as prompt in all
examples.

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-worktree.txt: recommend 'git worktree remove' over manual deletion</title>
<updated>2018-04-09T09:49:22Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2018-04-09T07:33:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3f0b42bd074fcb49ae9b18522e6b2b8a27aa07b6'/>
<id>urn:sha1:3f0b42bd074fcb49ae9b18522e6b2b8a27aa07b6</id>
<content type='text'>
When cc73385cf6 (worktree remove: new command, 2018-02-12) implemented
and documented 'git worktree remove', it forgot to update existing
instructions suggesting manual deletion. Fix this oversight by
recommending 'git worktree remove' instead.

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
