Skip to content

Commit 0f86a79

Browse files
sunshinecochriscool
authored andcommitted
rn-5: talk about new git-worktree command
1 parent cf6c355 commit 0f86a79

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

rev_news/drafts/edition-5.md

+59-1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,63 @@ to process the format passed in `--date=format:...`, a discussion
206206
about how to manage a potential strftime() failure when it is passed a
207207
bogus format ensued.
208208

209+
210+
* Linked-worktrees
211+
212+
The linked-worktree facility allows multiple working directories to share a
213+
single repository, with (typically) a different branch checked out in each
214+
worktree. Introduced more than half a year ago to provide integrated and
215+
platform-agnostic support for similar functionality long supplied by the
216+
Unix-only and somewhat fragile `contrib/git-new-workdir` script,
217+
linked-worktrees recently migrated to the *master* branch, but is not
218+
yet part of any release.
219+
220+
Creation of linked-worktrees is accomplished via `git checkout --to <path>
221+
<branch>`, and cleanup of leftover administrative files, after `<path>` is
222+
deleted, is done with `git prune --worktrees`. However, a recent unrelated
223+
change to `git prune` led to a
224+
[discussion](http://article.gmane.org/gmane.comp.version-control.git/272546)
225+
that concluded that worktree-related maintenance functionality doesn't
226+
belong in `git prune`.
227+
228+
Consequently, Nguyễn Thái Ngọc Duy submitted a
229+
[patch](http://thread.gmane.org/gmane.comp.version-control.git/272949)
230+
which introduces a new `git worktree` command, and relocates `git prune
231+
--worktrees` functionality to `git worktree prune`.
232+
233+
Eric Sunshine then further fleshed out `git worktree` with a
234+
[patch](http://article.gmane.org/gmane.comp.version-control.git/273032)
235+
which relocates `git checkout --to` functionality to `git worktree new`.
236+
A lengthy
237+
[discussion](http://thread.gmane.org/gmane.comp.version-control.git/273032)
238+
ensued, which eventually led to a second version, consisting of [23
239+
patches](http://thread.gmane.org/gmane.comp.version-control.git/273316),
240+
and which names the command `git worktree add`, rather than `git worktree
241+
new`, and gives the documentation some needed attention.
242+
243+
Aside from documentation updates, several other user-visible changes arrive
244+
with the second version. For instance, while preparing worktree-creation
245+
functionality for the move from `git checkout` to `git worktree`, Eric
246+
discovered and fixed a bug where `git checkout --to <path> HEAD~1` would
247+
instead incorrectly checkout `HEAD~2` at `<path>`.
248+
249+
The second version also introduces convenience enhancements. In
250+
particular, the `<branch>` in `git worktree add <path> <branch>`, is now
251+
optional. When omitted, a new branch is created automatically based upon
252+
`<path>`, as if `-b $(basename <path>)` had been provided (where `-b
253+
<new-branch>` creates a new branch). For example, given `git worktree add
254+
../hotfix`, a new branch named *hotfix* is created and checked out into new
255+
worktree `../hotfix`, as if `git worktree -b hotfix ../hotfix HEAD` had
256+
been specified.
257+
258+
Finally, the question was
259+
[raised](http://article.gmane.org/gmane.comp.version-control.git/273107)
260+
whether `git checkout --ignore-other-worktrees` should be retired and `git
261+
checkout --force` overloaded to subsume its duties, however, Junio was [not
262+
thrilled](http://article.gmane.org/gmane.comp.version-control.git/273108)
263+
by the idea.
264+
265+
209266
## Releases
210267

211268
* [git-multimail](https://github.com/git-multimail/git-multimail) [1.1.0](https://github.com/git-multimail/git-multimail/releases/tag/1.1.0) was released. git-multimail is a tool to send notification emails for pushes to a git repository. It is also available in the `contrib/hooks/multimail/` directory of Git's source tree (version 1.1.0 will be distributed with Git 2.5).
@@ -282,5 +339,6 @@ __Git tools and sites__
282339
## Credits
283340

284341
This edition of Git Rev News was curated by Christian Couder &lt;<[email protected]>&gt;,
285-
Thomas Ferris Nicolaisen &lt;<[email protected]>&gt; and Nicola Paolucci &lt;<[email protected]>&gt;
342+
Thomas Ferris Nicolaisen &lt;<[email protected]>&gt; Nicola Paolucci &lt;<[email protected]>&gt;,
343+
and Eric Sunshine &lt;<[email protected]>&gt;,
286344
with help from Junio C Hamano, Matthieu Moy and Johannes Schindelin.

0 commit comments

Comments
 (0)