某資料のモディファイ

後天性記憶不全なじーさん向けに Issue を登録しておいたのでヤッツけておくことに。
とりあえず PR で云々、と思っているので branch は分けるか。以下なカンジ?

$ git checkout -b Issue#4
Switched to a new branch 'Issue#4'

で、修正しては branch を push か。

$ git add tutorial.md
$ git commit
$ git push origin Issue#4
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 312 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
To git@github.com:yamanetoshi/Git-Handson.git
   d53684d..4f20627  Issue#4 -> Issue#4

で、再度 master branch に移動して branch 作成。

$ git checkout master
$ git checkout -b Issue#5
Switched to a new branch 'Issue#5'

なんか改行コードが微妙で diff が確認できぬ。一旦ディレクトリを削除して clone し直してみようかな。そんな程度で直れば苦労はしないのでしょうが。

$ cd ..
$ rm Git-Handson
$ git clone git@github.com:yamanetoshi/Git-Handson.git

これで作業再開してみます。
あ、駄目だ。diff が相変らず以下なカンジ。

$ git diff
diff --git a/tutorial.md b/tutorial.md
index c74d52d..c79bf5e 100644
--- a/tutorial.md
+++ b/tutorial.md
@@ -1 +1 @@
-# Git Handson^M^M## 最初に^M^MGit に関する基本的な操作方法を Hands-on 形式で学
\ No newline at end of file
+# Git Handson^M^M## 最初に^M^MGit に関する基本的な操作方法を Hands-on 形式で学
\ No newline at end of file

これは参った。以下な助言に沿って対処を施してみることに。

とりあえず、設定をアレ。

$ git config --global core.autocrlf true

で、以下。

$ git rm --cached -r .
rm '.gitignore'
rm 'README.md'
rm 'tutorial.md'
$ git diff --cached --name-only -z |xargs -0 git add
warning: LF will be replaced by CRLF in .gitignore.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in README.md.
The file will have its original line endings in your working directory.

ここで、status 確認してみたのですが以下な出力。

$ git status
# On branch FixCrLf
nothing to commit (working directory clean)

むむ、駄目か。つうかどうも

$ tr -d '\r' < tutorial.md

しても改行が復帰しない。手でヤれ、って事なのかorz

そして手動修正

終わりました。疲労困憊。

そして

merge して再度取得してみると以下な有様orz

# Git Handson^M
^M

なんだこのハマリ方はorz

と、思ったら

開き直したら不具合が解消している。これはもしかして git の設定のおかげなのかどうか。

core.autocrlf=true

それにしても色々な意味で謎すぎるorz
あと、向こうに merge しなきゃいけないのかとか非常に微妙。メモ取ってるはずなのですが、どうやるのかを完全に忘れているorz