{"id":671,"date":"2026-08-14T08:37:19","date_gmt":"2026-08-13T23:37:19","guid":{"rendered":"https:\/\/www.marchboy.xyz\/wordpress\/archives\/671"},"modified":"2026-08-14T08:37:19","modified_gmt":"2026-08-13T23:37:19","slug":"git%e3%81%ae%e3%82%a4%e3%83%b3%e3%83%87%e3%83%83%e3%82%af%e3%82%b9%e3%81%a8%e3%81%af%e4%bd%95%e3%81%8b","status":"publish","type":"post","link":"https:\/\/www.marchboy.xyz\/wordpress\/archives\/671","title":{"rendered":"git\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3068\u306f\u4f55\u304b"},"content":{"rendered":"<h2>git\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3068\u306f<\/h2>\n<p>git\u306f\u5206\u6563\u578b\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u3067\u3001\u4f5c\u696d\u30c4\u30ea\u30fc\uff08\u30ef\u30fc\u30af\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\uff09\u3068\u30ea\u30dd\u30b8\u30c8\u30ea\uff08\u5c65\u6b74\uff09\u306b\u52a0\u3048\u3066\u3001<strong>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\uff08\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u30a8\u30ea\u30a2\uff09<\/strong>\u3068\u3044\u3046\u4e2d\u9593\u9818\u57df\u3092\u6301\u3061\u307e\u3059\u3002\u3053\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f\u3001\u6b21\u306b\u30b3\u30df\u30c3\u30c8\u3059\u308b\u5185\u5bb9\u3092\u4e00\u6642\u7684\u306b\u4fdd\u5b58\u3059\u308b\u9818\u57df\u3067\u3059\u3002<\/p>\n<h3>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u5f79\u5272<\/h3>\n<ul>\n<li>\u4f5c\u696d\u30c4\u30ea\u30fc\u3067\u5909\u66f4\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u300c\u6b21\u306e\u30b3\u30df\u30c3\u30c8\u306b\u542b\u3081\u308b\u300d\u304b\u3069\u3046\u304b\u3092\u9078\u629e\u3067\u304d\u308b\u3002<\/li>\n<li>\u8907\u6570\u306e\u5909\u66f4\u3092\u8ad6\u7406\u7684\u306b\u30b0\u30eb\u30fc\u30d7\u5316\u3057\u3001\u7c92\u5ea6\u306e\u7d30\u304b\u3044\u30b3\u30df\u30c3\u30c8\u3092\u4f5c\u6210\u3067\u304d\u308b\u3002<\/li>\n<li>\u30b3\u30df\u30c3\u30c8\u524d\u306b\u5dee\u5206\u3092\u78ba\u8a8d\u3057\u305f\u308a\u3001\u90e8\u5206\u7684\u306b\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3057\u305f\u308a\u3067\u304d\u308b\u3002<\/li>\n<\/ul>\n<h3>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u64cd\u4f5c\u3059\u308b\u4e3b\u306a\u30b3\u30de\u30f3\u30c9<\/h3>\n<ul>\n<li><strong>git add &lt;path&gt;<\/strong> \u2013 \u30d5\u30a1\u30a4\u30eb\u3092\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u8ffd\u52a0\uff08\u30b9\u30c6\u30fc\u30b8\uff09\u3059\u308b\u3002<\/li>\n<li><strong>git reset &lt;path&gt;<\/strong> \u2013 \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u9664\u5916\u3057\u3001\u4f5c\u696d\u30c4\u30ea\u30fc\u306e\u5909\u66f4\u3060\u3051\u306b\u623b\u3059\u3002<\/li>\n<li><strong>git restore &#8211;staged &lt;path&gt;<\/strong> \u2013 <code>git reset<\/code> \u3068\u540c\u7b49\u3060\u304c\u3001\u610f\u56f3\u304c\u30b9\u30c6\u30fc\u30b8\u89e3\u9664\u3067\u3042\u308b\u3053\u3068\u3092\u660e\u793a\u3059\u308b\u3002<\/li>\n<li><strong>git commit<\/strong> \u2013 \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u3042\u308b\u5168\u3066\u306e\u5909\u66f4\u3092\u65b0\u3057\u3044\u30b3\u30df\u30c3\u30c8\u3068\u3057\u3066\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u4fdd\u5b58\u3059\u308b\u3002<\/li>\n<\/ul>\n<h3>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u5185\u90e8\u69cb\u9020\uff08\u7c21\u6613\u8aac\u660e\uff09<\/h3>\n<p>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f\u30ea\u30dd\u30b8\u30c8\u30ea\u5185\u90e8\u306e <code>.git\/index<\/code> \u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\u3055\u308c\u3001\u5404\u30a8\u30f3\u30c8\u30ea\u306f\u4ee5\u4e0b\u306e\u60c5\u5831\u3092\u6301\u3061\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9<\/li>\n<li>SHA-1\uff08\u307e\u305f\u306f SHA-256\uff09\u30cf\u30c3\u30b7\u30e5<\/li>\n<li>\u30d5\u30a1\u30a4\u30eb\u30e2\u30fc\u30c9\uff08\u5b9f\u884c\u6a29\u9650\u306a\u3069\uff09<\/li>\n<li>\u30b9\u30c6\u30fc\u30bf\u30b9\u30d5\u30e9\u30b0\uff08\u65b0\u898f\u3001\u5909\u66f4\u3001\u524a\u9664\uff09<\/li>\n<\/ul>\n<h3>\u5b9f\u969b\u306e\u4f7f\u7528\u4f8b<\/h3>\n<pre><code># \u4f5c\u696d\u30c4\u30ea\u30fc\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\nvim src\/app.js\n\n# \u5909\u66f4\u3092\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u8ffd\u52a0\uff08\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\uff09\ngit add src\/app.js\n\n# \u30b9\u30c6\u30fc\u30b8\u3055\u308c\u305f\u5185\u5bb9\u3092\u78ba\u8a8d\ngit status\n\n# \u3055\u3089\u306b\u5225\u306e\u30d5\u30a1\u30a4\u30eb\u3060\u3051\u3092\u30b9\u30c6\u30fc\u30b8\u3057\u306a\u3044\u3067\u30b3\u30df\u30c3\u30c8\u3057\u305f\u3044\u5834\u5408\ngit add README.md\n\ngit commit -m \"Update app.js and add README\"\n\n# \u30b9\u30c6\u30fc\u30b8\u3092\u89e3\u9664\u3057\u305f\u3044\u3068\u304d\ngit reset src\/app.js   # \u307e\u305f\u306f git restore --staged src\/app.js\n<\/code><\/pre>\n<h3>\u307e\u3068\u3081<\/h3>\n<p>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f\u300c\u6b21\u306b\u4f55\u3092\u30b3\u30df\u30c3\u30c8\u3059\u308b\u304b\u300d\u3092\u5236\u5fa1\u3059\u308b\u91cd\u8981\u306a\u9818\u57df\u3067\u3059\u3002<strong>git add<\/strong> \u3067\u30b9\u30c6\u30fc\u30b8\u3057\u3001<strong>git commit<\/strong> \u3067\u78ba\u5b9a\u3059\u308b\u6d41\u308c\u3092\u7406\u89e3\u3059\u308c\u3070\u3001\u7d30\u3084\u304b\u306a\u5c65\u6b74\u7ba1\u7406\u3084\u5b89\u5168\u306a\u30b3\u30fc\u30c9\u30ec\u30d3\u30e5\u30fc\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>git\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3068\u306f git\u306f\u5206\u6563\u578b\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u3067\u3001\u4f5c\u696d\u30c4\u30ea\u30fc\uff08\u30ef\u30fc\u30af\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\uff09\u3068\u30ea\u30dd\u30b8\u30c8\u30ea\uff08\u5c65\u6b74\uff09\u306b\u52a0\u3048\u3066\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\uff08\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u30a8\u30ea\u30a2\uff09\u3068\u3044\u3046\u4e2d\u9593\u9818\u57df\u3092\u6301\u3061\u307e\u3059\u3002\u3053\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f\u3001\u6b21\u306b\u30b3\u30df\u30c3\u30c8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-671","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/posts\/671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/comments?post=671"}],"version-history":[{"count":0,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/posts\/671\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/media?parent=671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/categories?post=671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/tags?post=671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}