{"id":2615,"date":"2018-07-24T18:01:25","date_gmt":"2018-07-24T09:01:25","guid":{"rendered":"https:\/\/www.chihayafuru.jp\/tech\/?p=2615"},"modified":"2021-06-15T14:38:38","modified_gmt":"2021-06-15T05:38:38","slug":"git-%e8%87%aa%e5%8b%95%e6%94%b9%e8%a1%8c%e3%82%b3%e3%83%bc%e3%83%89%e5%a4%89%e6%8f%9b","status":"publish","type":"post","link":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/archives\/2615","title":{"rendered":"[git] \u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db"},"content":{"rendered":"<p>Windows\u7248 Git \u306b\u306f commit \u3068 checkout \u306e\u3068\u304d\u306b\u3001\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u6539\u884c\u30b3\u30fc\u30c9(CRLF,LF)\u3092\u81ea\u52d5\u5909\u63db\u3059\u308b\u6a5f\u80fd\u304c\u3042\u308b\u3002<br \/>\n<!--more--><\/p>\n<p>&nbsp;<\/p>\n<h2>\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u6a5f\u80fd\u306e\u8a2d\u5b9a<\/h2>\n<h3>\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db \u6709\u52b9<\/h3>\n<pre class=\"lang:default highlight:0 decode:true \" >$ git config --local core.autocrlf true<\/pre>\n<h3>\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db \u7121\u52b9<\/h3>\n<pre class=\"lang:default highlight:0 decode:true \" >$ git config --local core.autocrlf false<\/pre>\n<h3>\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db \u30b3\u30df\u30c3\u30c8\u306e\u3068\u304d\u306e\u307f\uff08CRLF\u21d2LF\u4e00\u65b9\u5411\uff09<\/h3>\n<pre class=\"lang:default highlight:0 decode:true \" >$ git config --local core.autocrlf input<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u30bb\u30fc\u30d5\u8a2d\u5b9a<\/h2>\n<p>\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u6a5f\u80fd(autoCRLF)\u306f\u4fbf\u5229\uff08\u4f59\u8a08\u306a\u304a\u4e16\u8a71\uff1f\uff09\u3067\u3042\u308b\u304c\u3001\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u300e\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u300f\u304b\u300e\u30d0\u30a4\u30ca\u30ea\u30d5\u30a1\u30a4\u30eb\u300f\u304b\u306e\u5224\u5b9a\u3092git\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306b\u983c\u3063\u3066\u3044\u308b\u3002<br \/>\nCRLF \u3068 LF \u304c\u6df7\u5728\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306b\u304a\u3044\u3066\u3001\u3082\u3057\u4e00\u5f8b\u306bCRLF\u21d2LF\u5909\u63db\u304c\u5b9f\u884c\u3055\u308c\u308b\u3068\u7834\u58ca\u7684\u306a\u5909\u66f4\u3068\u306a\u308b\u3002\uff08\u9858\u308f\u304f\u306f\u3001\u305d\u306e\u3088\u3046\u306a\u30d5\u30a1\u30a4\u30eb\u306f\u5fc5\u305a\u300c\u30d0\u30a4\u30ca\u30ea\u300d\u3068\u5224\u5b9a\u3055\u308c\u3066\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u306e\u5bfe\u8c61\u5916\u3068\u306a\u308b\u3053\u3068\u304cgit\u306e\u671f\u5f85\u3055\u308c\u308b\u632f\u308b\u821e\u3044\u3067\u3042\u308b\u304c\u2026\uff09<br \/>\n<strong>safeCRLF<\/strong>\u3092\u6709\u52b9\u306b\u3059\u308b\u3068CRLF\u3068LF\u304c\u6df7\u5728\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306f\u5fc5\u305a\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u306e\u5bfe\u8c61\u5916\u3068\u306a\u308b\u3002<\/p>\n<pre class=\"lang:default highlight:0 decode:true \" >$ git config --global core.safecrlf true<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u5c5e\u6027(.gitattributes)\u306e\u8a2d\u5b9a<\/h2>\n<p>\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308b\uff08\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u5bfe\u8c61\u3067\u3042\u308b\uff09\u304b\u5426\u304b\u306e\u5224\u5b9a\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u8eab\u3092\u30b5\u30fc\u30c1\u3059\u308bgit\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u4f9d\u5b58\u3059\u308b\u3002\u3057\u304b\u3057\u5c5e\u6027(.gitattributes)\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u300e\u30d5\u30a1\u30a4\u30eb\u62e1\u5f35\u5b50\u300f\u306b\u3088\u3063\u3066\u300c\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u300dor\u300c\u30d0\u30a4\u30ca\u30ea\u30d5\u30a1\u30a4\u30eb\u300d\u306e\u5224\u5b9a\u3092\u884c\u3046\u3088\u3046\u306bgit\u306e\u632f\u308b\u821e\u3044\u3092\u5909\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002\u7279\u306bShift-JIS\u306e\u3088\u3046\u306b\u300c\u30c6\u30ad\u30b9\u30c8\u300d\u3068\u300c\u30d0\u30a4\u30ca\u30ea\u300d\u306e\u5224\u5b9a\u304c\u96e3\u3057\u3044\u6587\u5b57\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u3064\u304b\u3063\u3066\u3044\u308b\u30b1\u30fc\u30b9\u3067\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u62e1\u5f35\u5b50\u3067\u4e00\u5f8b\u306b\u300c\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u300d\u304b\u300c\u30d0\u30a4\u30ca\u30ea\u30d5\u30a1\u30a4\u30eb\u300d\u304b\u3092\u5224\u5b9a\u3059\u308b\u65b9\u6cd5\u304c\u78ba\u5b9f\u3067\u3042\u308b\u3002<\/p>\n<h3>.gitattributes \u306e\u8a18\u8ff0\u4f8b<\/h3>\n<pre class=\"lang:default highlight:0 decode:true \" >* text=auto\r\n*.c text eol=crlf\r\n*.h text eol=crlf<\/pre>\n<h3>\u95a2\u9023\u8a18\u4e8b<\/h3>\n<ul>\n<li><a href=\"\/tech\/index.php\/archives\/225\">[git] \u30c1\u30a7\u30c3\u30af\u30a4\u30f3\/\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8\u6642\u306e\u6539\u884c\u30b3\u30fc\u30c9\u81ea\u52d5\u5909\u63db<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Windows\u7248 Git \u306b\u306f commit \u3068 checkout \u306e\u3068\u304d\u306b\u3001\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u6539\u884c\u30b3\u30fc\u30c9(CRLF,LF)\u3092\u81ea\u52d5\u5909\u63db\u3059\u308b\u6a5f\u80fd\u304c\u3042\u308b\u3002<\/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-2615","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\/2615","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=2615"}],"version-history":[{"count":14,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/2615\/revisions"}],"predecessor-version":[{"id":4371,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/2615\/revisions\/4371"}],"wp:attachment":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/media?parent=2615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/categories?post=2615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/tags?post=2615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}