{"id":4447,"date":"2021-07-16T09:40:55","date_gmt":"2021-07-16T00:40:55","guid":{"rendered":"https:\/\/www.chihayafuru.jp\/tech\/?p=4447"},"modified":"2025-05-01T13:23:30","modified_gmt":"2025-05-01T04:23:30","slug":"git-worktree","status":"publish","type":"post","link":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/archives\/4447","title":{"rendered":"[git] worktree"},"content":{"rendered":"<h3>1. \u30ef\u30fc\u30af\u30c4\u30ea\u30fc\u306e\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8<\/h3>\n<h4>1.1. \u30b3\u30de\u30f3\u30c9\u66f8\u5f0f<\/h4>\n<pre class=\"lang:default highlight:0 decode:true \" >$ git worktree add &lt;\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8\u30d1\u30b9\u540d&gt; &lt;\u30d6\u30e9\u30f3\u30c1\u540d&gt;<\/pre>\n<h4>1.2. \u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u4f8b<\/h4>\n<pre class=\"lang:default highlight:0 decode:true \" >$ git worktree add ~\/Projects\/LocalMaster master<\/pre>\n<p><!--more--><\/p>\n<h4>1.3. \u88dc\u8db3\u8aac\u660e<\/h4>\n<p>\u4e0a\u8a18\u306e\u4f8b\u3067\u306f\u30ed\u30fc\u30ab\u30eb\u30fb\u30ea\u30dd\u30b8\u30c8\u30ea\uff08\u2252\u8d77\u70b9\u3068\u306a\u308b\u30ef\u30fc\u30af\uff09\u304c <b>~\/Projects\/LocalDevelop<\/b> \u306b\u3042\u308b\u3082\u306e\u3068\u3059\u308b\u3002\u3059\u3067\u306b\u30ef\u30fc\u30af\u30c4\u30ea\u30fc\u304c\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8\u3055\u308c\u305f\u30d5\u30a9\u30eb\u30c0\u306e\u4e0b\u306b\u65b0\u305f\u306a\u30ef\u30fc\u30af\u30c4\u30ea\u30fc\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8\u3059\u308b\u3068\u7169\u96d1\u306b\u306a\u308b\u305f\u3081\u3001\u305f\u3044\u3066\u3044\u306e\u5834\u5408\u3001\u5404\u3005\u306e\u30ef\u30fc\u30af\u30c4\u30ea\u30fc\u306e\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8\u30d5\u30a9\u30eb\u30c0\u306f\u5206\u96e2\u3059\u308b\u3002<\/p>\n<h3>2. \u30ef\u30fc\u30af\u30c4\u30ea\u30fc\u306e\u30ea\u30b9\u30c8<\/h3>\n<h4>2.1. \u30b3\u30de\u30f3\u30c9\u66f8\u5f0f<\/h4>\n<pre class=\"lang:default highlight:0 decode:true \" >$ git worktree list<\/pre>\n<h4>2.2. \u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u4f8b<\/h4>\n<pre class=\"lang:default highlight:0 decode:true \" >$ git worktree list\r\nC:\/Users\/Jane.Doe\/Projects\/LocalDevelop           fcb9a41 [develop]\r\nC:\/Users\/Jane.Doe\/Projects\/LocalMaster            2d04e24 [master]<\/pre>\n<h3>3. \u30ef\u30fc\u30af\u30c4\u30ea\u30fc\u306e\u524a\u9664<\/h3>\n<h4>3.1. \u30b3\u30de\u30f3\u30c9\u66f8\u5f0f<\/h4>\n<pre class=\"lang:default highlight:0 decode:true \" >$ git worktree remove ~\/Projects\/LocalMaster<\/pre>\n<h3>4. \u30ef\u30fc\u30af\u30c4\u30ea\u30fc\u306e\u5208\u8fbc\u307f<\/h3>\n<h4>4.1. \u30b3\u30de\u30f3\u30c9\u66f8\u5f0f<\/h4>\n<pre class=\"lang:default highlight:0 decode:true \" >$ git worktree prune<\/pre>\n<p>git\u30b3\u30de\u30f3\u30c9\u3092\u4ecb\u3055\u305a\u306b\u524a\u9664\u3057\u3066\u3057\u307e\u3063\u305f\u4f5c\u696d\u30d5\u30a9\u30eb\u30c0\u30fc\u306egit\u7ba1\u7406\u60c5\u5831\u3092\u5f8c\u8ffd\u3044\u3067\u4e00\u62ec\u3057\u3066\u524a\u9664\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3002<\/p>\n<ul>\n<li><code>rm -rf ~\/Project\/LocalMaster<\/code> \u306a\u3069\u306e\u65b9\u6cd5\u3067\u524a\u9664\u6e08\u307f\u306e\u30ef\u30fc\u30af\u30c4\u30ea\u30fc\uff08\u4f5c\u696d\u30d5\u30a9\u30eb\u30c0\u30fc\uff09\u306e\u6b8b\u3055\u308c\u305f\u30ef\u30fc\u30af\u30c4\u30ea\u30fc\u60c5\u5831\u3092\u524a\u9664\u3059\u308b\u3002<\/li>\n<li><code>git worktree remove<\/code>\u3092\u5b9f\u884c\u3057\u3001\u4f5c\u696d\u30d5\u30a9\u30eb\u30c0\u30fc\u3068\u30ef\u30fc\u30af\u30c4\u30ea\u30fc\u60c5\u5831\u3092\u4e00\u62ec\u3057\u3066\u524a\u9664\u3059\u308b\u65b9\u6cd5\u304c\u3001\u4f5c\u696d\u30d5\u30a9\u30eb\u30c0\u30fc\u3060\u3051\u3092\u76f4\u63a5\u524a\u9664\u3059\u308b\u3088\u308a\u3082\u5b89\u5168\u3067\u3042\u308b\u3002<code>git worktree remove<\/code> \u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u30ed\u30fc\u30ab\u30eb\u30ea\u30dd\u30b8\u30c8\u30ea(.git\u30d5\u30a9\u30eb\u30c0\u30fc)\u3092\u8aa4\u3063\u3066\u524a\u9664\u3059\u308b\u3053\u3068\u304c\u907f\u3051\u3089\u308c\u308b\u3002<\/li>\n<\/ul>\n<h3>5. References<\/h3>\n<ul>\n<li><a href=\"https:\/\/git-scm.com\/docs\/git-worktree\">Git &#8211; git-worktree Documentation<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1. \u30ef\u30fc\u30af\u30c4\u30ea\u30fc\u306e\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8 1.1. \u30b3\u30de\u30f3\u30c9\u66f8\u5f0f $ git worktree add &lt;\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8\u30d1\u30b9\u540d&gt; &lt;\u30d6\u30e9\u30f3\u30c1\u540d&gt; 1.2. \u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u4f8b $ git worktree  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[2],"class_list":["post-4447","post","type-post","status-publish","format-standard","hentry","category-memo","tag-git"],"_links":{"self":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/4447","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/comments?post=4447"}],"version-history":[{"count":23,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/4447\/revisions"}],"predecessor-version":[{"id":8015,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/4447\/revisions\/8015"}],"wp:attachment":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/media?parent=4447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/categories?post=4447"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/tags?post=4447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}