ãã®ãªããžããªã¯ãé»æ°é信倧åŠMMAã2014幎ã«éå¬ããRubyããã°ã©ãã³ã°ã¯ãŒã¯ã·ã§ããã§äœ¿çšããè³æåã³ããã°ã©ã ãå ¬éããããã®ãªããžããªã§ãã
ãã®ããã¹ãã§ã¯ãRubyã¯ãŒã¯ã·ã§ããã§è¡ã£ãããšãšãããã«é¢é£ããææžåã³ããã°ã©ã ã瀺ããŸãã
以äžã®è³æã¯ãåŠå ããäœæ¥ãè¡ãããšãåæã«èšè¿°ãããŠããŸããåŠå€ããã®å Žåãproxyãéããªããããªèšå®ã«åãæ¿ããå¿ èŠããããŸãã
Linuxã®ãã¹ã¯ãããã®å³äžã«è¡šç€ºãããŠããèªåã®IDãã¯ãªãã¯ãããã·ã¹ãã èšå®ããã¯ãªãã¯ããŸãã
ã·ã¹ãã èšå®ã®ãŠã£ã³ããŠãéãã®ã§ãããããã¯ãŒã¯ããã¯ãªãã¯ããŸãã
ããããã¯ãŒã¯ãããã·ããã¯ãªãã¯ãããšãproxyã®èšå®ãéãã®ã§ãããªããã«åãæ¿ããŸãã
ãŸãgitã䜿ãå Žåã¯ãgitã®ãããã·èšå®ãåãå¿ èŠããããŸããgitã®ãããã·èšå®ãåãããã«ã¯ã以äžã®ã³ãã³ããå®è¡ããŸãã
git config --global --unset http.proxy
git config --global --unset http.proxy
ãã¡ããåŠå ããã®å Žåã¯ãproxyèšå®ãåã³æå¹ã«ããå¿ èŠããããŸãã
- ããã°ã©ãã«å¿ èŠãª3ã€ã®ãã®ã玹ä»ããŸãã
- ã¯ãŒã¯ã·ã§ããã®ç®çãšæ¹éã玹ä»ããŸãã
- è¬ç¿äŒã§ã¯ãªãã¯ãŒã¯ã·ã§ããã§ããããšãèªçºçãªåå ãæè¿ããããšãäŒããŸãã
- åå ç»é²ã§ã®ã¢ã³ã±ãŒãçµæã玹ä»ããŸãã
- Rubyã®çŽ¹ä»ãããŸãã
Virtual Boxã¯ãã³ã³ãã¥ãŒã¿äžã«ä»®æ³çã«ã³ã³ãã¥ãŒã¿ãåçŸããããšãã§ãããœãããŠã§ã¢ã§ããä»åã¯ãããçšããŠãçããã®PCã®äžã«Linuxãæ°ãã«ã€ã³ã¹ããŒã«ããããšã«ããŸãã
Virtual Boxã®ã€ã³ã¹ããŒã«
Linuxã«ã¯æ§ã ãªçš®é¡ããããŸãããä»åã€ã³ã¹ããŒã«ããLinuxãšããŠã¯DebianãéžæããŸããã
Rubyã®ææ°ããŒãžã§ã³ã¯(2014/5/19çŸåš)2.1.2ã§ãããDebianã®åæç¶æ ã§ã€ã³ã¹ããŒã«å¯èœãªææ°ããŒãžã§ã³ã§ããRuby1.9.3ããšããããã€ã³ã¹ããŒã«ããŸãã
ãœãããŠã§ã¢éçºã®äŸãšããŠãäž»å¬ãã24æéã§éçºããã¹ããã¢ããªé£æºåWebãµãŒãã¹ã玹ä»ããŸããã
Rubyã§ã®æåã®ããã°ã©ã ãšããŠã1+1ã®çµæãåºåããããã°ã©ã ãäœæããåãããšã確èªããŸããã
- ãã¥ãŒãªã³ã°ãã·ã³ããã¥ãŒãªã³ã°å®å šãæ§é åå®çã®è©±ãããŸããã
- æ©æ¢°èªãšã¢ã»ã³ããªããããŠããé«åºŠãªããã°ã©ãã³ã°èšèªãšã®é¢é£ã®è©±ãããŸããã
rbenvã¯ãè€æ°ã®ããŒãžã§ã³ã®Rubyãç°¡åã«åãæ¿ããããšãã§ããããŒã«ã§ãã
- putsãšgets
- å€æ°
- é å
- eachã䜿ã£ãç¹°ãè¿ã ã«ã€ããŠããã°ã©ã ã觊ããªããåŠã³ãŸããã
putsã¯ãæååãç»é¢ã«åºåãããããã®åœä»€ã§ããæååãšã¯ãæåã䞊ãã§ãããããªããŒã¿ã®ããšãæããŸããæååã¯æåã®äžŠã³ã''ã""ã§å²ãã§è¡šããŸãã
'hogehoge'
'ãŸããã '
putsã¯ã以äžã®ããã«ããŠäœ¿ããŸãã
puts 'hogehoge'
äžã®ããã°ã©ã ãå®è¡ãããšããhogehogeããšããæååã衚瀺ãããŸãã
getsã¯ãéã«ããŒããŒãããå ¥åãããæååãåŸãåœä»€ã§ãã getsã¯ã以äžã®ããã«ããŠäœ¿ããŸãã
a = gets
aãšgetsã®éã«ããçå·ã¯ãå³åŽã®çµæã«å·ŠåŽã«æžãããŠããååã察å¿ä»ãããšããæå³ã§ããã€ãŸãããgetsã®çµæã«aãšããååãã€ããããšããããšãè¡šããŸããaã®ããšããå€æ°ããšèšããŸããå€æ°ãšããŒã¿ã®éã«å¯Ÿå¿ä»ããè¡ãããšãããä»£å ¥ããšãããŸãããã®å Žåããaã«getsã®çµæãä»£å ¥ããããšãããŸãã
putsãšgetsã®äŸ putsãšgetsã®äŸ
å€ãã®ããŒã¿ãæ±ããšããå€æ°ããããã䞊ãã§ãããããªæ§é ãåããã€ããããšäŸ¿å©ãªããšããããŸããRubyã§ã¯ãã®ãããªæ§é ããé åããšåŒãã§ããŠãå©çšããããšãã§ããŸããé åã¯æ¬¡ã®ããã«ããŠäœ¿ããŸãã
a = [1, 2, 3]
äžã®äŸã¯ããaãšããå€æ°ã«1,2,3ãšããé åãä»£å ¥ãããç¶æ ãè¡šããŠããŸãã1ã®å ¥ã£ãå€æ°ã2ã®å ¥ã£ãå€æ°ã3ã®å ¥ã£ãå€æ°ãé çªã«äžŠãã§ãããããªã€ã¡ãŒãžã§ãããããã®ããŒã¿ã«ã¯ãåããé çªã«0çªç®ã1çªç®ã2çªç®ãšçªå·ãã€ããŠããŸãããã®çªå·ã䜿ã£ãŠãé åã«äžã«ã¯ãã£ãŠããããŒã¿ãåãåºãããšãã§ããŸãã
a[0]
a[1]
äžã®ããã«æžããšããããã1ãš2ãšããçµæãåŸãããŸãã
é åã«å ¥ã£ãŠããããããã®ããŒã¿ãããèŠçŽ ããšãããŸãã
é åã®èŠçŽ ãé ã ã«åãåºããŠãããããã«ã€ããŠåŠçãè¡ããããšããããšããããŸããäŸãã°é åã®èŠçŽ ãåãåºããŠputsã§åºåãããšãã£ãããšã§ãããã®ãããªåŠçãç°¡åã«æžããããã«ãããããRubyã«ã¯eachãšãããã®ãçšæãããŠããŸãã
a = [1, 2, 3]
a.each do |i|
puts a
end
äžã®ããã°ã©ã ã¯ãeachãçšããäŸã§ããeachãçšãããšãåŸãã®doãendã®ããã°ã©ã ãç¹°ãè¿ãå®è¡ãããŸãããã®æé åã®èŠçŽ ãé ã ã«åãåºãããŠ|ã§å²ãŸããå€æ°ã«ä»£å ¥ãããŸããã€ãŸããäžã®ããã°ã©ã ãå®è¡ãããšã次ã®çµæãåŸãããŸãã
1
2
3
é åãšç¹°ãè¿ã é åã®å©çšäŸ
Rubyã®åºç€ã®åŠç¿ã®ç¶ããè¡ããŸããã
é åã¯ãçªå·ã䜿ã£ãŠããŒã¿ãåãåºããããªããŒã¿æ§é ã§ããããåãªãçªå·ã§ã¯ãªããããå°ãããããããæååã§ç€ºãããç®å°ã䜿ããé åããããšäŸ¿å©ããã§ãããã®ãããªæ§é ãšããŠãããã·ã¥ãšãããã®ãçšæãããŠããŸãã
a = {:name => "alstamber", :age => 22}
äžã®ããã°ã©ã ããããã·ã¥ã®å©çšäŸã§ãããã®ããã·ã¥ã¯ã次ã®ããã«å©çšã§ããŸãã
a[:name]
äžã®ããã°ã©ã ãå®è¡ãããšãalstamberãšããæååãåŸãããŸãã
ããããããã°ã©ã ã®æµãã¯ãåçŽãªäžããäžãžã®å®è¡ãç¹°ãè¿ããæ¡ä»¶åå²ã®3ã€ã§æžãããšãã§ããŸããåçŽãªå®è¡ãšç¹°ãè¿ãã¯ããã§ã«ãããŸãããããšã¯æ¡ä»¶åå²ã®ã¿ã§ããæ¡ä»¶åå²ãšã¯ãããæ¡ä»¶ãæºãããŠããæã®ã¿ãäºã決ããããããã°ã©ã ãå®è¡ãããšããåŠçã®æµãã§ãã
Rubyã§ã®æ¡ä»¶åå²ã¯ãifåŒãšãããã®ãçšããŠæžããŸãã
if a == 1 then
puts "a is 1"
end
äžã®ããã°ã©ã ã¯ãa == 1ãšããæ¡ä»¶ãæºãããŠããã°ãputs "a is 1"ãšããéšåãå®è¡ãããšããããã°ã©ã ã§ãã==ã¯å·Šãšå³ã«ãããã®ãçããããšãè¡šããã®ã§ãã
if a == 1 then
puts "a is 1"
else
puts "a is not 1"
end
elseã䜿ããšãæ¡ä»¶ãæºãããŠããªãã£ãæã®åŠçãèšè¿°ããããšãã§ããŸãã
å€æ°ãé åãããã·ã¥ã¯ãããŒã¿ã«ååãã€ããããã®ãã®ã§ããããããã²ãšãããŸãã®åŠçã«ååãä»ãããæããããŸããäŸãã°ã次ã®ãããªããã°ã©ã ãèããŸãã
a = "abc"
hoge(a)
fuga(a)
puts a
puts "-----"
a = "def"
hoge(a)
fuga(a)
puts a
ããã§hogeãfugaãputs aãšãããã®ã2åçŸããŠããããšãããããŸãã2åããããªãã³ããã§äœãšããªãããã§ããããããäœåºŠãäœåºŠãåºãŠãããããªãšãã«ãã¡ãã¡ãã®3ã€ãæžãã®ã¯é¢åèãã§ããããããã§ããã®3ã€ã«ãŸãšããŠååãã€ããããšã«ããŸãã
def func(a)
hoge(a)
fuga(a)
puts a
end
aa = "abc"
func(aa)
ãã®ããã°ã©ã ã§ãdefããendã®éšåããåŠçã«ååãã€ããŠããéšåã§ããã®åŸãã®2è¡ããå®éã«ãã®åŠçãå©çšããŠããéšåã§ããfunc(aa)ãšããããã°ã©ã ãå®è¡ãããšãdef func(a)ã®aã®éšåãaaãšçœ®ãæããããŸããã€ãŸãäžã®ããã°ã©ã ã¯ã次ã®ããã«æžããã®ãšåãã§ãã
aa = "abc"
hoge(aa)
fuga(aa)
puts aa
ãã®ããã°ã©ã ã䜿ããšãæåã«æ瀺ããããã°ã©ã ã¯ã次ã®ããã«æžãæããããŸãã
a = "abc"
func(a)
puts "-----"
a = "def"
func(a)
Markdownã¯ãèŠåºããªã©ã®æ§é ãæã£ãææžãæ軜ã«èšè¿°ããããšãã§ããèšèªã§ãã Daring Fireball: Markdown
ãŸããHTMLã¯ãWebããŒãžã®æ§é ãèšè¿°ããããã«çšããããŠããèšèªã§ããWebãã©ãŠã¶ã¯ãHTMLãèªã¿èŸŒãã§ããŠããã®æ§é ã解æãããã®æ§é ãè¡šçŸããããã«èŠèŠçã«ç»é¢ã«è¡šç€ºããŠããŸãã
å žåçãªHTMLã§æžãããææžã以äžã«ç€ºããŸãã
<html>
<head>
<title>ã¿ã€ãã«</title>
</head>
<body>
<p>
ãããã
</p>
</body>
</html>
<>ã§å²ãŸããéšåãã¿ã°ãšãããŸããã¿ã°ã¯éå§ã¿ã°ãšçµäºã¿ã°ã®çµã«ãªã£ãŠããŸããäžã®äŸã®å Žåã<title>ã®ãããªãã®ãéå§ã¿ã°ã§ã</title>ã®ãããªãã®ãçµäºã¿ã°ã§ããéå§ã¿ã°ãšçµäºã¿ã°ã§æãŸããéšåãããã®ã¿ã°ã®å 容ã«ãªããŸããtitleã¿ã°ã®ããã«æ®éã®æååãå 容ãšããŠæã€ã¿ã°ããããŸãããheadãbodyã®ããã«ãäžè¬ã«æŽã«å¥ã®ã¿ã°ãå 容ãšããŠæã€ã¿ã°ããããŸãã
ã¿ã°ããã£ã¬ã¯ããªãã¿ã°ãæã€å¥ã®ã¿ã°ãåãã£ã¬ã¯ããªãã¿ã°ãæã€æ®éã®æååããã¡ã€ã«ã«äŸããã°ãHTMLã®æ§é ã¯UNIXã®ãã£ã¬ã¯ããªæ§é ãšãã£ããã§ããã«ãŒããã£ã¬ã¯ããªã«çžåœããå Žæããhtmlã¿ã°ã§ãããã®ãããªæ§é ãæšæ§é ãšãããŸããæ€ç©ã®æšãã²ã£ããè¿ããæã®æ§é ã«ãã£ããã ããã§ãã
äžã®äžã«ã¯ããããã®Rubyããã°ã©ã ãååšããŸããããããã«ã¯å ±éããåŠçãšãããã®ãããã¿ãããŸãããã®ãããªåŠçã¯ããã¡ãã¡æã§äžããæžãã®ã§ã¯ãªããäºãçšæããŠãããããã°ã©ã ãèªã¿èŸŒãã§ããŠå©çšããããã«ããã®ã䟿å©ã§ãããªããªããäžåºŠããããããã°ã©ã ãäœã£ãŠããã°ããããèªã¿èŸŒãã ãã§ãããã£ãåŠçãã§ããããã«ãªããããã°ã©ã ã®æéãçããŸããããŸãç¡çšãªãã¹ãæžããããšãã§ããããã§ãããã®ãããªããã°ã©ã ã®ããšããã©ã€ãã©ãªãšåŒã³ãŸããæ¬åœã«é »ç¹ã«äœ¿ãããåŠç(æ¥ä»ããŒã¿ãåŠçãããªã©)ã«ã€ããŠã¯ãRubyã«æšæºã§ã©ã€ãã©ãªãçšæãããŠããŠããããèªã¿èŸŒãåœä»€ãèšè¿°ããã ãã§ãå©çšã§ããããã«ãªã£ãŠããŸããããããRubyã«æšæºã§ã¯åãã£ãŠããªããã©ãããããªãã®é »åºŠã§è¡ãããåŠçãšããã®ããããŸããäŸãã°ãããURLãããã¡ã€ã«ãèªã¿èŸŒãã§ãããšããåŠçãªã©ãè¯ãäŸã§ãããããã£ãåŠçã«ã€ããŠã¯ãæå¿ãäœæãã€ã³ã¿ãŒãããäžã«å ¬éããŠããã©ã€ãã©ãªãããŠã³ããŒãããŠããŠãèªã¿ããããã«ããããšã§ãäžããéçºããæéãçããããšããããŸãã
Rubyã«ã¯ãæå¿ãã€ã³ã¿ãŒãããäžã«ããããããã°ã©ã ãå ¬éããä»çµã¿ãçšæãããŠããŸãããã®ä»çµã¿ãgemãšããã§ããŸããRubyãã€ã³ã¹ããŒã«ãããšãåæã«gemãšããã³ãã³ãã䜿ããããã«ãªããŸãã
gem install <gemå>
ãšããã°ãæå®ããååã®gemãã€ã³ã¹ããŒã«ããããšãã§ããŸããã€ã³ã¹ããŒã«ããgemã¯ãRubyããã°ã©ã ã®å é ã«
require 'gemå'
ãšæžãããšã§ãèªã¿èŸŒãã§å©çšããããšãã§ããŸãã
Rdiscountã¯ãMarkdownãHTMLã«å€åãããããæ©èœãæäŸããgemã§ãã
gem install rdiscount
ãšããããšã§ãRdiscountãã€ã³ã¹ããŒã«ã§ããŸãã
require 'rdiscount' # Rdiscountãèªã¿èŸŒãã§ãã
f = open('hoge.md') # openãšããã¡ãœãããçšããŠãhoge.mdãšãããã¡ã€ã«ãéããŠãã
text = f.read # éãããã¡ã€ã«ãtextãšããå€æ°ã«èªã¿èŸŒãã§ä»£å
¥ããŠãã
f.close # ãã¡ã€ã«ã¯éãããéãã
markdown = RDiscount.new(text) # RDiscount.newã¡ãœããã䜿ãããšã§ãæååãMarkdownãšããŠè§£æããŠèªã¿èŸŒãããšãã§ãã
print markdown.to_html # èªã¿èŸŒãã Markdownãto_htmlã¡ãœããã䜿ã£ãŠHTMLã«å€æããŠç»é¢ã«åºå
äžã®ããã°ã©ã ã¯ãhoge.mdãšããMarkdownã§æžããããã¡ã€ã«ãå 容ãèªã¿åã£ãŠããããHTMLã«å€æããŠè¡šç€ºããããã°ã©ã ã§ãã
nokogiriã¯HTMLã®äžéšãæå®ããŠåãåºãããšãã§ããgemã§ããHTMLãæšæ§é ã«ãªã£ãŠãããšãã話ã第4åã«ããŸãããããã®æšã®äžéšãåã£ãŠãããšããããã®ãããã䜿ã£ãŠããããã«ã¿ããããšããããã®ãããªååãã€ããããã§ãã
gem install nokogiri
ãšããããšã§ãnokogiriãã€ã³ã¹ããŒã«ããããšãã§ããŸãã
require 'nokogiri'
require 'open-uri' # æå®ããURLãããã¡ã€ã«ãèªã¿èŸŒãããã®ã©ã€ãã©ãª
f = open('http://www.uec.ac.jp') # UECã®å
¬åŒããŒãžãéã
html = f.read # éããããŒãžããèªã¿èŸŒã
f.close
tree = Nokogori::HTML.parse(html) # htmlã解æããŠãæšæ§é ãšããŠæ±ããããã«ãã
äžã®ããã°ã©ã ã¯ãUECã®å ¬åŒããŒãžãèªã¿èŸŒãã§ãNokogiriã䜿ã£ãŠæšæ§é ãåãåºãããã°ã©ã ã§ããHTMLãèªã¿èŸŒãã§ããã ãã§ã¯ããã ã®æåã®çŸ åã§ãããã«æšæ§é ãèŠåºãããšã¯ã§ããŸãããNokogiri::HTML.parseã¡ãœããã䜿ãããšã§ããã ã®æåã®çŸ åãnokogiriã解æããæšæ§é ãšããŠæ±ããããã«ãªããŸãã
äžã®ããã°ã©ã ã«ãã£ãŠãnokogiriãçšããŠæšæ§é ãäœãåºãããšã¯ã§ããŸãããnokogiriã®æ¬æ¥ã®ç®çã§ããæšã®äžéšãåã£ãŠããããã«ã¯ãæšã®ã©ã®éšåãåã£ãŠããã®ããæå®ã§ããå¿ èŠããããŸããnokogiriã§ã¯ããã®æ¹æ³ãšããŠXPathãšãããã®ãšCSSã»ã¬ã¯ã¿ãšãããã®ãæäŸããŠããŸããä»åã®ã¯ãŒã¯ã·ã§ããã§ã¯ãCSSã»ã¬ã¯ã¿ãçšããããšã«ããŸãã
CSSã¯ãHTMLã§æžãããææžã®ãã¶ã€ã³ã決ããããã®èšèªã§ããCSSã¯ãHTMLã®ã¿ã°ãæå®ãããã®ã¿ã°ã®éšåã«å¯ŸããŠã©ã®ãããªãã¶ã€ã³ãè¡ãã®ããæå®ãã圢ã§ãã¶ã€ã³ãäœã£ãŠãããŸããäŸãã°ã
a {
color : red;
}
äžã®ãããªCSSã¯ãaãšããã¿ã°ã®å 容ã«ã€ããŠãè²ãèµ€è²ã«ããªãããšããããšãæå®ããŠããŸãã
CSSã§ãHTMLã®ã¿ã°ãæå®ããéã«çšããã®ãCSSã»ã¬ã¯ã¿ã§ããäžã®äŸã®å ŽåãaãCSSã»ã¬ã¯ã¿ã§ãã
p, div
ã®ããã«ãã«ã³ãã§åºåã£ãŠè€æ°åã䞊ã¹ããšãpã¿ã°ããã³divã¿ã°ãšèšãæå³ã«ãªããŸãããŸã
p > a
ã®ããã«æžããšãpã¿ã°ã®äžã«é 眮ãããŠããaã¿ã°ãšããæå³ã«ãªããŸãã
å°ãåã«æžãããšãããnokogiriã§ã¯HTMLãšããæšã®äžéšåãæå®ããéã«ãCSSã»ã¬ã¯ã¿ã䜿ãããšãã§ããŸããäŸãã°ã
tree = Nokogori::HTML.parse(html)
a = tree.css('a')
```
ãšãããšãtreeãšããæšã®äžããaã¿ã°ã®éšåãåãã ãããŠãaãšããå€æ°ã«ä»£å
¥ãããŸããäŸãã°ã
```
<p>
<a>ãããã</a>
</p>
```
ãšããHTMLã«å¯ŸããŠãäžã®ããã°ã©ã ãå®è¡ããã°ã<a>ãããã</a>ã®éšåã ããåãåºãããšãã§ããŸããããã§å°ãç«ã¡æ¢ãŸã£ãŠèããŠã¿ããšãããããHTMLãå
¥åãšããŠèããæããã®HTMLã®æšã®äžããaã¿ã°ã®éšåã ããåãåºãããšãããšããã®çµæã¯è€æ°åã«ãªãå¯èœæ§ããããŸããäŸãã°ã
```
<p>
<a>ãããã</a>
<a>ãããã</a>
</p>
```
ãšããHTMLãèããæãããã«å¯ŸããŠäžã®ããã°ã©ã ãå®è¡ãããšã<a>ãããã</a>ãš<a>ãããã</a>ãšãã2ã€ã®çµæãåŸãããŸãããªã®ã§ãcssãšããã¡ãœããã¯ãé
åãè¿ãããã«ãªã£ãŠããŠãeachã¡ãœãããå®è¡ããããšãã§ããŸãã
```
tree = Nokogori::HTML.parse(html)
tree.css('a').each do |a|
puts a.inner_text # inner_textã¡ãœããã¯ãã¿ã°ã®äžèº«ãåãåºãã¡ãœãã
end
```
äžã®ããã°ã©ã ãå®è¡ãããšãhtmlã®äžã«å«ãŸããŠãããã¹ãŠã®aã¿ã°ãåãåºããŠããŠããã®äžèº«ãputsã¡ãœããã§åºåãããšããåããããŸãã
#### gitã«ããå±¥æŽç®¡ç
gitã䜿ããšãããã°ã©ã éçºã«ãããããã°ã©ã ã®å€æŽå±¥æŽãèšé²ããããšãã§ããŸãã
gitãçšããã«ã¯ãgitã§ç®¡çããããã¡ã€ã«ããããŠãããã£ã¬ã¯ããªäžã§
```
git init
```
ãšããã³ãã³ããå®è¡ããŸãã
gitã®åºæ¬çãªå©çšæ¹æ³ã¯ãgit initãããã£ã¬ã¯ããªã«ãããã¡ã€ã«ãç·šéããåŸãã©ã®ãããªç·šéãè¡ã£ãã®ããèšé²ããããšã§ãã
gitã§ãã¡ã€ã«ã®å€æŽå±¥æŽã管çããããã«ã¯ããŸãå€æŽå±¥æŽãèšé²ããããã¡ã€ã«ãgitã®ç®¡çäžã«å
¥ããå¿
èŠããããŸãã
```
git add ãã¡ã€ã«å
```
ãšããã³ãã³ããå®è¡ãããšãæå®ãããã¡ã€ã«ãgitã®ç®¡çäžã«çœ®ãããšãã§ããŸãã
git addããäžã§ã次ã¯å€æŽå±¥æŽãèšé²ããŸããå€æŽå±¥æŽãèšé²ããããã«ã¯ã
```
git commit
```
ãšããã³ãã³ããå®è¡ããŸãããã®ã³ãã³ãã®ååãããå€æŽå±¥æŽãèšé²ããããšãã³ããããããšãèšããŸãã
ãã®ã³ãã³ããå®è¡ãããšãããã¹ããšãã£ã¿ãéããŸããããã«å€æŽç¹ã«ã€ããŠç°¡åã«ãŸãšããŠèšè¿°ããäžã§ä¿åãããšããããgitã«ãã£ãŠèšé²ãããŸãããã®èšé²ã¯ã
```
git log
```
ãšããã³ãã³ãã§ãã€ã§ãé²èŠ§ã§ããŸãã
ããã°ã©ã éçºã®éã«ã¯ãããã°ã©ã ãå€æŽããâgit addããâgit commitãã ã®ç¹°ãè¿ããè¡ã£ãŠãããã°ã©ã ã®å€æŽå±¥æŽãèšé²ããŠããããšãéèŠã§ãããã®èšé²ãããŠããããšã§ãåŸã§ãã°ãçºçããæã«å
ã«ãã©ãããããããšã容æã«ãªããŸãã
ã¡ãªã¿ã«ããã®ææžãgitã«ãã£ãŠå€æŽå±¥æŽã管çãããŠããŸãã
### 第6å