際際滷

際際滷Share a Scribd company logo
尖盾したつもりになる赫庄岳秘壇




       2010/10/02 Hokkaido.pm #2
     幄塀氏芙アイダック CPS並I何
                      恃?直xレ
徭失B初

?   恃?直xレ
?   Twitter @aloelight
?   Blog http://blog.vitamin11.org/
?   プログラマ 惹 サ`バ砿尖宀
尖盾したつもりになる赫庄岳秘壇
尖盾したつもりになる赫庄岳秘壇
書晩の坪否?

? Gitとは
? gなGitの聞い圭
? 皆顎恢厩艶姻壊庄看稼と赫庄岳の離い
Gitとは

Git┐っとはプログラムなどのソ`スコ`ド砿尖を佩う蛍
柊侏バ`ジョン砿尖システム。嘛堀業に嶷泣が崔かれている。
Linuxカ`ネルのソ`スコ`ド砿尖を朕議として、リ`ナス?
ト`バルズによって_kされた。
                     安庄一庄沿艶糸庄温より哈喘
バ`ジョン砿尖システムとは

麼にプログラムのソ`スコ`ド吉のファイルの筝堕sを砿尖
するシステム
バ`ジョン砿尖を佩う尖喇

 ? lがソ`スを筝したのかすぐわかる
?? ???commitのauthorをみれば匯k

 ? 音醤栽があればgに念のバ`ジョンにせる
?? ???index.html.2010102 ○ こういう音侑なファイルが伏まれな
い

 ? }方繁が峠佩して_kする彜rを覿┐靴討い
? ? ? ? 辛嬬なら徭咾mergeダメならn融を鷂罎靴討れる
メジャ`なバ`ジョン砿尖システム

?   Bazaar
?   CVS
?   Subversion
?   Mercurial
?   Monotone
?   その麿弼?
Gitを聞う尖喇

?   Perl云悶のバ`ジョン砿尖がGit
?   忽坪のメジャ`なPerl HackerがGithubを聞っている
?   Subversionからの卞佩が護と否叟
?   嘛堀業が堀い
?   ネットワ`クに、っていなくてもcommitできる
?   どんどん歇罎佑覆commitできる
?   仝Subversionは嶄僥伏まで々と冱われたから
g縞に聞ってみる
インスト`ル

光OSのパッケ`ジ砿尖システムでさっくりとインスト`ル

 ? Mac OSX
?? ? ?# port install git-core

 ? Linux RedHat狼
?? ? ?# yum install git

 ? Linux Debian狼
?? ? # aptitude install git-core
恷兜にえるべきコマンド




    git help
g佩してみる
yoshi@mb yoshi% git help?
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
?? ? ? ? ? [-p|--paginate|--no-pager] [--no-replace-objects]
?? ? ? ? ? [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
?? ? ? ? ? [--help] COMMAND [ARGS]

The most commonly used git commands are:
?? add ? ? ? ?Add file contents to the index
?? bisect ? ? Find by binary search the change that introduced a bug
?? branch ? ? List, create, or delete branches
?? checkout ? Checkout a branch or paths to the working tree
?? clone ? ? ?Clone a repository into a new directory

---snip---

?? rm ? ? ? ? Remove files from the working tree and from the index
?? show ? ? ? Show various types of objects
?? status ? ? Show the working tree status
?? tag ? ? ? ?Create, list, delete or verify a tag object signed with GPG

See 'git help COMMAND' for more information on a specific command.
兜豚O協

徭蛍のユ`ザ兆とメ`ルアドレスをO協する

$ git config --global user.name 'Yoshihiro Sasaki'
$ git config --global user.email 'aloelight at gmail.com'

$ cat ~/.gitconfig
[user]
?? ? ? ?name = Yoshihiro Sasaki
?? ? ? ?email = aloelight at gmail.com
どこで聞われるの

コミットrに徭咾琶垢錣譯コミットログでれます

yoshi@mb Plack-Middleware-Parallel-Scoreboard% git log
commit 993c5c4cdfe6395f4bb21a633de90d5159135cd8
Author: Yoshihiro Sasaki <aloelight@gmail.com>
Date: ? Wed Jul 14 20:21:27 2010 +0900

?? ?copy from http://gist.github.com/464066
_kの送れ

1. リポジトリの恬撹
2. ファイルの仟ラ啓咤筝
3. コミット
4. 2,3をRり卦す
リポジトリを恬撹する

yoshi@mb tmp% module-setup Hokkaido ??
--snip--
yoshi@mb tmp% cd Hokkaido/
yoshi@mb Hokkaido% git init
Initialized empty Git repository in /Users/yoshi/tmp/Hokkaido/.git/
.gitの嶄附
yoshi@mb Hokkaido% tree .git
.git
|-- HEAD
|-- config
|-- description
|-- hooks
| ? |-- applypatch-msg.sample
| ? |-- commit-msg.sample
| ? |-- post-commit.sample
| ? |-- post-receive.sample
| ? |-- post-update.sample
| ? |-- pre-applypatch.sample
| ? |-- pre-commit.sample
| ? |-- pre-rebase.sample
| ? |-- prepare-commit-msg.sample
| ? `-- update.sample
|-- info
| ? `-- exclude
|-- objects
| ? |-- info
| ? `-- pack
`-- refs
?? ?|-- heads
?? ?`-- tags
書の彜Bの_J

yoshi@mb Hokkaido% git status
# On branch master
#
# Initial commit
#
# Untracked files:
# ? (use "git add <file>..." to include in what will be committed)
#
# ? ? ? .gitignore
# ? ? ? .shipit
# ? ? ? Changes
# ? ? ? MANIFEST.SKIP
# ? ? ? Makefile.PL
# ? ? ? README
# ? ? ? lib/
# ? ? ? t/
# ? ? ? xt/
nothing added to commit but untracked files present (use "git add" to track)
ファイルを弖紗する

yoshi@mb Hokkaido% git add . ? ? ? ? ?
yoshi@mb Hokkaido% git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# ? (use "git rm --cached <file>..." to unstage)
#
# ? ? ? new file: ? .gitignore
# ? ? ? new file: ? .shipit
# ? ? ? new file: ? Changes
# ? ? ? new file: ? MANIFEST.SKIP
# ? ? ? new file: ? Makefile.PL
# ? ? ? new file: ? README
# ? ? ? new file: ? lib/Hokkaido.pm
# ? ? ? new file: ? t/00_compile.t
# ? ? ? new file: ? xt/01_podspell.t
# ? ? ? new file: ? xt/02_perlcritic.t
# ? ? ? new file: ? xt/03_pod.t
# ? ? ? new file: ? xt/perlcriticrc
#
コミットする

yoshi@mb Hokkaido% git commit -m '兜豚彜Bをコミットします'
[master (root-commit) 3bec145] 兜豚彜Bをコミットします
?12 files changed, 137 insertions(+), 0 deletions(-)
?create mode 100644 .gitignore
?create mode 100644 .shipit
?create mode 100644 Changes
?create mode 100644 MANIFEST.SKIP
?create mode 100644 Makefile.PL
?create mode 100644 README
?create mode 100644 lib/Hokkaido.pm
?create mode 100644 t/00_compile.t
?create mode 100644 xt/01_podspell.t
?create mode 100644 xt/02_perlcritic.t
?create mode 100644 xt/03_pod.t
?create mode 100644 xt/perlcriticrc
ファイルを筝してみる 1

yoshi@mb Hokkaido% vim t/00_compile.t?
yoshi@mb Hokkaido% git diff t/00_compile.t?
diff --git a/t/00_compile.t b/t/00_compile.t
index aa5eee9..a054976 100644
--- a/t/00_compile.t
+++ b/t/00_compile.t
@@ -1,4 +1,7 @@
?use strict;
-use Test::More tests => 1;
+use Test::More tests => 2;
?
?BEGIN { use_ok 'Hokkaido' }
+
+my @method = qw/cities members/;
+can_ok 'Hokkaido', @method;
ファイルを筝してみる 2
yoshi@mb Hokkaido% vim lib/Hokkaido.pm?
yoshi@mb Hokkaido% git diff lib/ ? ? ? ? ? ?
diff --git a/lib/Hokkaido.pm b/lib/Hokkaido.pm
index 1e5e118..f2f7921 100644
--- a/lib/Hokkaido.pm
+++ b/lib/Hokkaido.pm
@@ -1,7 +1,15 @@
?package Hokkaido;
?use strict;
?use warnings;
-our $VERSION = '0.01';
+our $VERSION = '0.02';
+
+sub cities {
+ ? ? ? qw/sapporo obihiro kushiro/
+}
+
+sub members {
+ ? ? ? qw/foo bar baz/
+}
?
?1;
?__END__
壅業F壓の彜Bを_J

yoshi@mb Hokkaido% git status
# On branch master
# Changed but not updated:
# ? (use "git add <file>..." to update what will be committed)
# ? (use "git checkout -- <file>..." to discard changes in working directory)
#
# ? ? ? modified: ? lib/Hokkaido.pm
# ? ? ? modified: ? t/00_compile.t
#
no changes added to commit (use "git add" and/or "git commit -a")
筝をコミット

yoshi@mb Hokkaido% git add -u
yoshi@mb Hokkaido% git status
# On branch master
# Changes to be committed:
# ? (use "git reset HEAD <file>..." to unstage)
#
# ? ? ? modified: ? lib/Hokkaido.pm
# ? ? ? modified: ? t/00_compile.t
#


yoshi@mb Hokkaido% git commit -m 'cities, membersv方とそのテストの弖紗'
[master 66dd358] cities, membersv方とそのテストの弖紗
?2 files changed, 13 insertions(+), 2 deletions(-)
飴 git add するのは採絞か

     ちゃんと筝したファイルを哇龍してコミットしよう

git add と git commit はこんなイメ`ジになります
+--------------+ ?git add ( staging ) ? +-------+ ?git commit ? +------------+
| working copy | ---------------------> | index | ------------> | repository |
+--------------+ ? ? ? ? ? ? ? ? ? ? ? ?+-------+ ? ? ? ? ? ? ? +------------+
その麿のC嬬

?   タグ原け
?   チェックアウト
?   ブランチの恬撹
?   マ`ジの返と盾h
?   揖匯ファイルの筝の匯何をコミット
?   バグが詞秘したコミットを冥す
タグを恬撹する

yoshi@mb Hokkaido% git log
commit 66dd3588d1047bcf57b363a6ac7cd39a23ea73ef
Author: Yoshihiro Sasaki <aloelight@gmail.com>
Date: ? Thu Sep 30 01:28:18 2010 +0900

?? ?cities, membersv方とそのテストの弖紗

commit 3bec145de901a0420768d3fdb6e480f044e32ef8
Author: Yoshihiro Sasaki <aloelight@gmail.com>
Date: ? Thu Sep 30 01:09:39 2010 +0900

? ? ? 兜豚彜Bをコミットします
yoshi@mb Hokkaido% git tag 0.01 3bec145de
yoshi@mb Hokkaido% git tag 0.02
yoshi@mb Hokkaido% git tag -l
0.01
0.02
チェックアウト

yoshi@mb Hokkaido% git log --oneline
66dd358 cities, membersv方とそのテストの弖紗
3bec145 兜豚彜Bをコミットします

yoshi@mb Hokkaido% git checkout 3bec145 ? ? ??
Note: checking out '3bec145'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

??git checkout -b new_branch_name

HEAD is now at 3bec145... 兜豚彜Bをコミットします
ブランチの恬撹

yoshi@mb Hokkaido%?git checkout?3bec145?? ? ??
Note: checking out '3bec145'.

yoshi@mb Hokkaido% git checkout -b b0.01
Switched to a new branch 'b0.01'

yoshi@mb Hokkaido% git status
# On branch b0.01
nothing to commit (working directory clean)

yoshi@mb Hokkaido% git branch
* b0.01
??master
ブランチの恬撹と界鞄艶界一看顎岳を揖扮に佩
         う
yoshi@mb Hokkaido% git checkout -b b0.02 0.02 ? ?
Switched to a new branch 'b0.02'

yoshi@mb Hokkaido% git branch
??b0.01
* b0.02
??master
マ`ジの返 1

1. マ`ジ圷になる。レブランチを恬撹する
yoshi@mb Hokkaido% git checkout -b obihiro master

2. lib/Hokkaido.pmにv方を弖紗
yoshi@mb Hokkaido% git diff
diff --git a/lib/Hokkaido.pm b/lib/Hokkaido.pm
index f2f7921..808390e 100644
--- a/lib/Hokkaido.pm
+++ b/lib/Hokkaido.pm
@@ -11,6 +11,9 @@ sub members {
?? ? ? ?qw/foo bar baz/
?}
?
+sub obihiro {
+ ? ? ? qw/眉圭鎗 マルセイバタ`サンド 諤S/
+}
マ`ジの返 2

3. obihiroブランチにcommit
yoshi@mb Hokkaido% git commit -a -m 'obihirov方の弖紗'
[obihiro b33faa0] obihirov方の弖紗
?1 files changed, 3 insertions(+), 0 deletions(-)

4. masterブランチに俳り紋えてmerge
yoshi@mb Hokkaido% git checkout master?
Switched to branch 'master'
yoshi@mb Hokkaido% git merge obihiro
Updating 66dd358..b33faa0
Fast-forward
?lib/Hokkaido.pm | ? ?3 +++
?1 files changed, 3 insertions(+), 0 deletions(-)
マ`ジY惚の盾h 1

            Updating 66dd358..b33faa0って採

yoshi@mb Hokkaido% git log --oneline
b33faa0 obihirov方の弖紗
66dd358 cities, membersv方とそのテストの弖紗
3bec145 兜豚彜Bをコミットします
マ`ジY惚の盾h 2

           Fast-forwardって採
merge念のリポジトリの彜B
+------+   ? ?   +--------+ ? ? +---------+
| 0.01 |   -->   | ?0.02 ?| --> | obihiro |
+------+   ? ?   +--------+ ? ? +---------+
?? ? ? ?   ? ?   ? ^
?? ? ? ?   ? ?   ? H
?? ? ? ?   ? ?   ? H
?? ? ? ?   ? ?   +--------+
?? ? ? ?   ? ?   | master |
?? ? ? ?   ? ?   +--------+


Fast-forwardでのmerge瘁の彜B
+------+   ? ?   +------+ ? ? +---------+
| 0.01 |   -->   | 0.02 | --> | obihiro |
+------+   ? ?   +------+ ? ? +---------+
?? ? ? ?   ? ?   ? ? ? ? ? ? ? ?^
?? ? ? ?   ? ?   ? ? ? ? ? ? ? ?H
?? ? ? ?   ? ?   ? ? ? ? ? ? ? ?H
?? ? ? ?   ? ?   ? ? ? ? ? ? ?+---------+
?? ? ? ?   ? ?   ? ? ? ? ? ? ?| master ?|
?? ? ? ?   ? ?   ? ? ? ? ? ? ?+---------+
マ`ジY惚の盾h 3

     じゃあFast-forwardじゃないマ`ジはどんなの
merge念
+--------+   ? ?   +------+ ? ? +---------+
| ?0.01 ?|   -->   | 0.02 | --> | obihiro |
+--------+   ? ?   +------+ ? ? +---------+
?? ? ? ? ?   ? ?   ? |
?? ? ? ? ?   ? ?   ? |
?? ? ? ? ?   ? ?   ? v
+--------+   ? ?   +------+
| master |   ==>   | 0.03 |
+--------+   ? ?   +------+


merge瘁
+------+   ? ?   +------+ ? ? +---------+ ? ? +--------+ ? ? +--------+
| 0.01 |   -->   | 0.02 | --> | obihiro | --> | merged | <== | master |
+------+   ? ?   +------+ ? ? +---------+ ? ? +--------+ ? ? +--------+
?? ? ? ?   ? ?   ? | ? ? ? ? ? ? ? ? ? ? ? ? ? ?^
?? ? ? ?   ? ?   ? | ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
?? ? ? ?   ? ?   ? v ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
?? ? ? ?   ? ?   +------+ ? ? ? ? ? ? ? ? ? ? ? |
?? ? ? ?   ? ?   | 0.03 | ----------------------+
?? ? ? ?   ? ?   +------+
揖匯ファイルの匯何をコミット 1
                       とりあえず筝してみる

yoshi@mb Hokkaido% vim lib/Hokkaido.pm
yoshi@mb Hokkaido% git diff -U0 ? ? ? ? ??
diff --git a/lib/Hokkaido.pm b/lib/Hokkaido.pm
index 808390e..47acbf9 100644
--- a/lib/Hokkaido.pm
+++ b/lib/Hokkaido.pm
@@ -4 +4 @@ use warnings;
-our $VERSION = '0.02';
+our $VERSION = '0.03';
@@ -7 +7 @@ sub cities {
- ? ? ? qw/sapporo obihiro kushiro/
+ ? ? ? qw/sapporo obihiro kushiro asahikawa hakodata/
@@ -15 +15 @@ sub obihiro {
- ? ? ? qw/眉圭鎗 マルセイバタ`サンド 諤S/
+ ? ? ? qw/諤S 眉圭鎗 諤S マルセイバタ`サンド 諤S/
揖匯ファイルの匯何をコミット 2

yoshi@mb Hokkaido% git add -p
diff --git a/lib/Hokkaido.pm b/lib/Hokkaido.pm
index 808390e..47acbf9 100644
--- a/lib/Hokkaido.pm
+++ b/lib/Hokkaido.pm
@@ -1,10 +1,10 @@
?package Hokkaido;
?use strict;
?use warnings;
-our $VERSION = '0.02';
+our $VERSION = '0.03';

?sub cities {
- ? ? ? qw/sapporo obihiro kushiro/
+ ? ? ? qw/sapporo obihiro kushiro asahikawa hakodata/
?}

?sub members {
Stage this hunk [y,n,q,a,d,/,j,J,g,s,e,?]? y
揖匯ファイルの匯何をコミット 3

肝のhunkはaddしたくないのでnをxk
@@ -12,7 +12,7 @@ sub members {
?}
?
?sub obihiro {
- ? ? ? qw/眉圭鎗 マルセイバタ`サンド 諤S/?
+ ? ? ? qw/諤S 眉圭鎗 諤S マルセイバタ`サンド 諤S/
?}
?1;
?__END__
Stage this hunk [y,n,q,a,d,/,K,g,e,?]? n
バグが詞秘したコミットを冥す 1

? git bisect でgに冥せます
? 光コミットにして good or bad をO協する
? good, bad のgを屈蛍冥沫で圻咀となるコミットを冥す
バグが詞秘したコミットを冥す 2

                   bisectのサブコマンド
?   git bisect start
?   git bisect good [コミット]
?   git bisect bad [コミット]
?   git bisect reset
?   git bisect run command
バグが詞秘したコミットを冥す? 3

    わかりにくいので禽掘珂或
まとめ

? git help と? git status をえればなんとかなる
? 嘛が堀いのでbranchの恬撹mergeを毫Xに佩える
? git bisect と git add -p が宴旋
恷朔に傚
嵎諒タイム
ご賠ありがとうございました

More Related Content

尖盾したつもりになる赫庄岳秘壇

  • 1. 尖盾したつもりになる赫庄岳秘壇 2010/10/02 Hokkaido.pm #2 幄塀氏芙アイダック CPS並I何 恃?直xレ
  • 2. 徭失B初 ? 恃?直xレ ? Twitter @aloelight ? Blog http://blog.vitamin11.org/ ? プログラマ 惹 サ`バ砿尖宀
  • 5. 書晩の坪否? ? Gitとは ? gなGitの聞い圭 ? 皆顎恢厩艶姻壊庄看稼と赫庄岳の離い
  • 8. バ`ジョン砿尖を佩う尖喇 ? lがソ`スを筝したのかすぐわかる ?? ???commitのauthorをみれば匯k ? 音醤栽があればgに念のバ`ジョンにせる ?? ???index.html.2010102 ○ こういう音侑なファイルが伏まれな い ? }方繁が峠佩して_kする彜rを覿┐靴討い ? ? ? ? 辛嬬なら徭咾mergeダメならn融を鷂罎靴討れる
  • 9. メジャ`なバ`ジョン砿尖システム ? Bazaar ? CVS ? Subversion ? Mercurial ? Monotone ? その麿弼?
  • 10. Gitを聞う尖喇 ? Perl云悶のバ`ジョン砿尖がGit ? 忽坪のメジャ`なPerl HackerがGithubを聞っている ? Subversionからの卞佩が護と否叟 ? 嘛堀業が堀い ? ネットワ`クに、っていなくてもcommitできる ? どんどん歇罎佑覆commitできる ? 仝Subversionは嶄僥伏まで々と冱われたから
  • 12. インスト`ル 光OSのパッケ`ジ砿尖システムでさっくりとインスト`ル ? Mac OSX ?? ? ?# port install git-core ? Linux RedHat狼 ?? ? ?# yum install git ? Linux Debian狼 ?? ? # aptitude install git-core
  • 14. g佩してみる yoshi@mb yoshi% git help? usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path] ?? ? ? ? ? [-p|--paginate|--no-pager] [--no-replace-objects] ?? ? ? ? ? [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] ?? ? ? ? ? [--help] COMMAND [ARGS] The most commonly used git commands are: ?? add ? ? ? ?Add file contents to the index ?? bisect ? ? Find by binary search the change that introduced a bug ?? branch ? ? List, create, or delete branches ?? checkout ? Checkout a branch or paths to the working tree ?? clone ? ? ?Clone a repository into a new directory ---snip--- ?? rm ? ? ? ? Remove files from the working tree and from the index ?? show ? ? ? Show various types of objects ?? status ? ? Show the working tree status ?? tag ? ? ? ?Create, list, delete or verify a tag object signed with GPG See 'git help COMMAND' for more information on a specific command.
  • 15. 兜豚O協 徭蛍のユ`ザ兆とメ`ルアドレスをO協する $ git config --global user.name 'Yoshihiro Sasaki' $ git config --global user.email 'aloelight at gmail.com' $ cat ~/.gitconfig [user] ?? ? ? ?name = Yoshihiro Sasaki ?? ? ? ?email = aloelight at gmail.com
  • 16. どこで聞われるの コミットrに徭咾琶垢錣譯コミットログでれます yoshi@mb Plack-Middleware-Parallel-Scoreboard% git log commit 993c5c4cdfe6395f4bb21a633de90d5159135cd8 Author: Yoshihiro Sasaki <aloelight@gmail.com> Date: ? Wed Jul 14 20:21:27 2010 +0900 ?? ?copy from http://gist.github.com/464066
  • 18. リポジトリを恬撹する yoshi@mb tmp% module-setup Hokkaido ?? --snip-- yoshi@mb tmp% cd Hokkaido/ yoshi@mb Hokkaido% git init Initialized empty Git repository in /Users/yoshi/tmp/Hokkaido/.git/
  • 19. .gitの嶄附 yoshi@mb Hokkaido% tree .git .git |-- HEAD |-- config |-- description |-- hooks | ? |-- applypatch-msg.sample | ? |-- commit-msg.sample | ? |-- post-commit.sample | ? |-- post-receive.sample | ? |-- post-update.sample | ? |-- pre-applypatch.sample | ? |-- pre-commit.sample | ? |-- pre-rebase.sample | ? |-- prepare-commit-msg.sample | ? `-- update.sample |-- info | ? `-- exclude |-- objects | ? |-- info | ? `-- pack `-- refs ?? ?|-- heads ?? ?`-- tags
  • 20. 書の彜Bの_J yoshi@mb Hokkaido% git status # On branch master # # Initial commit # # Untracked files: # ? (use "git add <file>..." to include in what will be committed) # # ? ? ? .gitignore # ? ? ? .shipit # ? ? ? Changes # ? ? ? MANIFEST.SKIP # ? ? ? Makefile.PL # ? ? ? README # ? ? ? lib/ # ? ? ? t/ # ? ? ? xt/ nothing added to commit but untracked files present (use "git add" to track)
  • 21. ファイルを弖紗する yoshi@mb Hokkaido% git add . ? ? ? ? ? yoshi@mb Hokkaido% git status # On branch master # # Initial commit # # Changes to be committed: # ? (use "git rm --cached <file>..." to unstage) # # ? ? ? new file: ? .gitignore # ? ? ? new file: ? .shipit # ? ? ? new file: ? Changes # ? ? ? new file: ? MANIFEST.SKIP # ? ? ? new file: ? Makefile.PL # ? ? ? new file: ? README # ? ? ? new file: ? lib/Hokkaido.pm # ? ? ? new file: ? t/00_compile.t # ? ? ? new file: ? xt/01_podspell.t # ? ? ? new file: ? xt/02_perlcritic.t # ? ? ? new file: ? xt/03_pod.t # ? ? ? new file: ? xt/perlcriticrc #
  • 22. コミットする yoshi@mb Hokkaido% git commit -m '兜豚彜Bをコミットします' [master (root-commit) 3bec145] 兜豚彜Bをコミットします ?12 files changed, 137 insertions(+), 0 deletions(-) ?create mode 100644 .gitignore ?create mode 100644 .shipit ?create mode 100644 Changes ?create mode 100644 MANIFEST.SKIP ?create mode 100644 Makefile.PL ?create mode 100644 README ?create mode 100644 lib/Hokkaido.pm ?create mode 100644 t/00_compile.t ?create mode 100644 xt/01_podspell.t ?create mode 100644 xt/02_perlcritic.t ?create mode 100644 xt/03_pod.t ?create mode 100644 xt/perlcriticrc
  • 23. ファイルを筝してみる 1 yoshi@mb Hokkaido% vim t/00_compile.t? yoshi@mb Hokkaido% git diff t/00_compile.t? diff --git a/t/00_compile.t b/t/00_compile.t index aa5eee9..a054976 100644 --- a/t/00_compile.t +++ b/t/00_compile.t @@ -1,4 +1,7 @@ ?use strict; -use Test::More tests => 1; +use Test::More tests => 2; ? ?BEGIN { use_ok 'Hokkaido' } + +my @method = qw/cities members/; +can_ok 'Hokkaido', @method;
  • 24. ファイルを筝してみる 2 yoshi@mb Hokkaido% vim lib/Hokkaido.pm? yoshi@mb Hokkaido% git diff lib/ ? ? ? ? ? ? diff --git a/lib/Hokkaido.pm b/lib/Hokkaido.pm index 1e5e118..f2f7921 100644 --- a/lib/Hokkaido.pm +++ b/lib/Hokkaido.pm @@ -1,7 +1,15 @@ ?package Hokkaido; ?use strict; ?use warnings; -our $VERSION = '0.01'; +our $VERSION = '0.02'; + +sub cities { + ? ? ? qw/sapporo obihiro kushiro/ +} + +sub members { + ? ? ? qw/foo bar baz/ +} ? ?1; ?__END__
  • 25. 壅業F壓の彜Bを_J yoshi@mb Hokkaido% git status # On branch master # Changed but not updated: # ? (use "git add <file>..." to update what will be committed) # ? (use "git checkout -- <file>..." to discard changes in working directory) # # ? ? ? modified: ? lib/Hokkaido.pm # ? ? ? modified: ? t/00_compile.t # no changes added to commit (use "git add" and/or "git commit -a")
  • 26. 筝をコミット yoshi@mb Hokkaido% git add -u yoshi@mb Hokkaido% git status # On branch master # Changes to be committed: # ? (use "git reset HEAD <file>..." to unstage) # # ? ? ? modified: ? lib/Hokkaido.pm # ? ? ? modified: ? t/00_compile.t # yoshi@mb Hokkaido% git commit -m 'cities, membersv方とそのテストの弖紗' [master 66dd358] cities, membersv方とそのテストの弖紗 ?2 files changed, 13 insertions(+), 2 deletions(-)
  • 27. 飴 git add するのは採絞か ちゃんと筝したファイルを哇龍してコミットしよう git add と git commit はこんなイメ`ジになります +--------------+ ?git add ( staging ) ? +-------+ ?git commit ? +------------+ | working copy | ---------------------> | index | ------------> | repository | +--------------+ ? ? ? ? ? ? ? ? ? ? ? ?+-------+ ? ? ? ? ? ? ? +------------+
  • 28. その麿のC嬬 ? タグ原け ? チェックアウト ? ブランチの恬撹 ? マ`ジの返と盾h ? 揖匯ファイルの筝の匯何をコミット ? バグが詞秘したコミットを冥す
  • 29. タグを恬撹する yoshi@mb Hokkaido% git log commit 66dd3588d1047bcf57b363a6ac7cd39a23ea73ef Author: Yoshihiro Sasaki <aloelight@gmail.com> Date: ? Thu Sep 30 01:28:18 2010 +0900 ?? ?cities, membersv方とそのテストの弖紗 commit 3bec145de901a0420768d3fdb6e480f044e32ef8 Author: Yoshihiro Sasaki <aloelight@gmail.com> Date: ? Thu Sep 30 01:09:39 2010 +0900 ? ? ? 兜豚彜Bをコミットします yoshi@mb Hokkaido% git tag 0.01 3bec145de yoshi@mb Hokkaido% git tag 0.02 yoshi@mb Hokkaido% git tag -l 0.01 0.02
  • 30. チェックアウト yoshi@mb Hokkaido% git log --oneline 66dd358 cities, membersv方とそのテストの弖紗 3bec145 兜豚彜Bをコミットします yoshi@mb Hokkaido% git checkout 3bec145 ? ? ?? Note: checking out '3bec145'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: ??git checkout -b new_branch_name HEAD is now at 3bec145... 兜豚彜Bをコミットします
  • 31. ブランチの恬撹 yoshi@mb Hokkaido%?git checkout?3bec145?? ? ?? Note: checking out '3bec145'. yoshi@mb Hokkaido% git checkout -b b0.01 Switched to a new branch 'b0.01' yoshi@mb Hokkaido% git status # On branch b0.01 nothing to commit (working directory clean) yoshi@mb Hokkaido% git branch * b0.01 ??master
  • 32. ブランチの恬撹と界鞄艶界一看顎岳を揖扮に佩 う yoshi@mb Hokkaido% git checkout -b b0.02 0.02 ? ? Switched to a new branch 'b0.02' yoshi@mb Hokkaido% git branch ??b0.01 * b0.02 ??master
  • 33. マ`ジの返 1 1. マ`ジ圷になる。レブランチを恬撹する yoshi@mb Hokkaido% git checkout -b obihiro master 2. lib/Hokkaido.pmにv方を弖紗 yoshi@mb Hokkaido% git diff diff --git a/lib/Hokkaido.pm b/lib/Hokkaido.pm index f2f7921..808390e 100644 --- a/lib/Hokkaido.pm +++ b/lib/Hokkaido.pm @@ -11,6 +11,9 @@ sub members { ?? ? ? ?qw/foo bar baz/ ?} ? +sub obihiro { + ? ? ? qw/眉圭鎗 マルセイバタ`サンド 諤S/ +}
  • 34. マ`ジの返 2 3. obihiroブランチにcommit yoshi@mb Hokkaido% git commit -a -m 'obihirov方の弖紗' [obihiro b33faa0] obihirov方の弖紗 ?1 files changed, 3 insertions(+), 0 deletions(-) 4. masterブランチに俳り紋えてmerge yoshi@mb Hokkaido% git checkout master? Switched to branch 'master' yoshi@mb Hokkaido% git merge obihiro Updating 66dd358..b33faa0 Fast-forward ?lib/Hokkaido.pm | ? ?3 +++ ?1 files changed, 3 insertions(+), 0 deletions(-)
  • 35. マ`ジY惚の盾h 1 Updating 66dd358..b33faa0って採 yoshi@mb Hokkaido% git log --oneline b33faa0 obihirov方の弖紗 66dd358 cities, membersv方とそのテストの弖紗 3bec145 兜豚彜Bをコミットします
  • 36. マ`ジY惚の盾h 2 Fast-forwardって採 merge念のリポジトリの彜B +------+ ? ? +--------+ ? ? +---------+ | 0.01 | --> | ?0.02 ?| --> | obihiro | +------+ ? ? +--------+ ? ? +---------+ ?? ? ? ? ? ? ? ^ ?? ? ? ? ? ? ? H ?? ? ? ? ? ? ? H ?? ? ? ? ? ? +--------+ ?? ? ? ? ? ? | master | ?? ? ? ? ? ? +--------+ Fast-forwardでのmerge瘁の彜B +------+ ? ? +------+ ? ? +---------+ | 0.01 | --> | 0.02 | --> | obihiro | +------+ ? ? +------+ ? ? +---------+ ?? ? ? ? ? ? ? ? ? ? ? ? ? ?^ ?? ? ? ? ? ? ? ? ? ? ? ? ? ?H ?? ? ? ? ? ? ? ? ? ? ? ? ? ?H ?? ? ? ? ? ? ? ? ? ? ? ? ?+---------+ ?? ? ? ? ? ? ? ? ? ? ? ? ?| master ?| ?? ? ? ? ? ? ? ? ? ? ? ? ?+---------+
  • 37. マ`ジY惚の盾h 3 じゃあFast-forwardじゃないマ`ジはどんなの merge念 +--------+ ? ? +------+ ? ? +---------+ | ?0.01 ?| --> | 0.02 | --> | obihiro | +--------+ ? ? +------+ ? ? +---------+ ?? ? ? ? ? ? ? ? | ?? ? ? ? ? ? ? ? | ?? ? ? ? ? ? ? ? v +--------+ ? ? +------+ | master | ==> | 0.03 | +--------+ ? ? +------+ merge瘁 +------+ ? ? +------+ ? ? +---------+ ? ? +--------+ ? ? +--------+ | 0.01 | --> | 0.02 | --> | obihiro | --> | merged | <== | master | +------+ ? ? +------+ ? ? +---------+ ? ? +--------+ ? ? +--------+ ?? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? ? ? ?^ ?? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ?? ? ? ? ? ? ? v ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ?? ? ? ? ? ? +------+ ? ? ? ? ? ? ? ? ? ? ? | ?? ? ? ? ? ? | 0.03 | ----------------------+ ?? ? ? ? ? ? +------+
  • 38. 揖匯ファイルの匯何をコミット 1 とりあえず筝してみる yoshi@mb Hokkaido% vim lib/Hokkaido.pm yoshi@mb Hokkaido% git diff -U0 ? ? ? ? ?? diff --git a/lib/Hokkaido.pm b/lib/Hokkaido.pm index 808390e..47acbf9 100644 --- a/lib/Hokkaido.pm +++ b/lib/Hokkaido.pm @@ -4 +4 @@ use warnings; -our $VERSION = '0.02'; +our $VERSION = '0.03'; @@ -7 +7 @@ sub cities { - ? ? ? qw/sapporo obihiro kushiro/ + ? ? ? qw/sapporo obihiro kushiro asahikawa hakodata/ @@ -15 +15 @@ sub obihiro { - ? ? ? qw/眉圭鎗 マルセイバタ`サンド 諤S/ + ? ? ? qw/諤S 眉圭鎗 諤S マルセイバタ`サンド 諤S/
  • 39. 揖匯ファイルの匯何をコミット 2 yoshi@mb Hokkaido% git add -p diff --git a/lib/Hokkaido.pm b/lib/Hokkaido.pm index 808390e..47acbf9 100644 --- a/lib/Hokkaido.pm +++ b/lib/Hokkaido.pm @@ -1,10 +1,10 @@ ?package Hokkaido; ?use strict; ?use warnings; -our $VERSION = '0.02'; +our $VERSION = '0.03'; ?sub cities { - ? ? ? qw/sapporo obihiro kushiro/ + ? ? ? qw/sapporo obihiro kushiro asahikawa hakodata/ ?} ?sub members { Stage this hunk [y,n,q,a,d,/,j,J,g,s,e,?]? y
  • 40. 揖匯ファイルの匯何をコミット 3 肝のhunkはaddしたくないのでnをxk @@ -12,7 +12,7 @@ sub members { ?} ? ?sub obihiro { - ? ? ? qw/眉圭鎗 マルセイバタ`サンド 諤S/? + ? ? ? qw/諤S 眉圭鎗 諤S マルセイバタ`サンド 諤S/ ?} ?1; ?__END__ Stage this hunk [y,n,q,a,d,/,K,g,e,?]? n
  • 41. バグが詞秘したコミットを冥す 1 ? git bisect でgに冥せます ? 光コミットにして good or bad をO協する ? good, bad のgを屈蛍冥沫で圻咀となるコミットを冥す
  • 42. バグが詞秘したコミットを冥す 2 bisectのサブコマンド ? git bisect start ? git bisect good [コミット] ? git bisect bad [コミット] ? git bisect reset ? git bisect run command
  • 43. バグが詞秘したコミットを冥す? 3 わかりにくいので禽掘珂或
  • 44. まとめ ? git help と? git status をえればなんとかなる ? 嘛が堀いのでbranchの恬撹mergeを毫Xに佩える ? git bisect と git add -p が宴旋