Ëͼ«¿ÈÊÙ¶¯Ãæ¤Ê¤ó¤Ç¤¹¤¬¡£
** Âè°ì²ógitÊÙ¶¯²ñ [#ff1e5cea]
- 2009/09/08 »²²Ã¼Ô »ÖÅÄ¡¢Ãݼ¤µ¤ó¡¢ÂçÄÔ¤µ¤ó
- ¥Í¥¿¸µ: gittutorial(7) http://www8.atwiki.jp/git_jp/pub/git-manual-jp/Documentation/gittutorial.html
** Æ°²è [#pafb1329]
#htmlinsert(study/git-1.html)
** ¤Þ¤º³µÇ°¤«¤é [#z84c12e0]
- ʬ»¶¥ì¥Ý¥¸¥È¥ê´ÉÍý¤È¤Ï?
#blikimore
http://sourceforge.jp/magazine/09/02/02/0655246
- ³Æ¼«¼«Ê¬ÍÑ¥ì¥Ý¥¸¥È¥ê¤ò¤â¤Ä
-- ¥ì¥Ý¥¸¥È¥ê ¢â ºî¶È¥Ç¥£¥ì¥¯¥È¥ê
- ¾¤Î¥ì¥Ý¥¸¥È¥ê¤Ëcommit¤Ç¤¤ë(push)
- ¾¤Î¥ì¥Ý¥¸¥È¥ê¤«¤é¥Ñ¥Ã¥Á¤ò¼èÆÀ¤·¤Æcommit¤Ç¤¤ë(pull)
- Ê£¿ô¿Í¤Ç¥ì¥Ý¥¸¥È¥ê¤òƱ´ü¤·¤Ê¤¬¤é³«È¯¤ò¤·¤Æ¤¤¤¯¤Ë¤Ï?
http://sourceforge.jp/magazine/09/02/02/0655246
- ¥Þ¥¹¥¿¡¼¥ì¥Ý¥¸¥È¥ê - 1¤Ä
-- Ãæ±û¤Î¤ß¤ó¤ÊÍÑ¥ì¥Ý¥¸¥È¥ê¤ò¥á¥ó¥Ð¡¼¤Ê¤éï¤Ç¤â¥¢¥¯¥»¥¹¤Ç¤¤ë¾ì½ê¤Ë¤ª¤¯
- ¸Ä¿ÍÍÑ¥ì¥Ý¥¸¥È¥ê - ¿Í¿ôʬ
- ³Æ¼«¸Ä¿ÍÍÑ¥ì¥Ý¥¸¥È¥ê¤Ëcommit¸å¡¢¤½¤ì¤ò¥Þ¥¹¥¿¡¼¥ì¥Ý¥¸¥È¥ê¤Ëpush
- ¾¿Í¤¬push¤·¤¿commit¤ò¥Þ¥¹¥¿¡¼¥ì¥Ý¥¸¥È¥êpull¤·¤Æ¸Ä¿ÍÍÑ¥ì¥Ý¥¸¥È¥ê¤Ë
** ÆÃħ¡¢²¿¤¬¤¦¤ì¤·¤¤¤Î¤«? [#n04c0900]
- ¥í¡¼¥«¥ë¤Ë¤¹¤Ù¤Æ¤Î¾ðÊ󤬤¢¤ë¤Î¤ÇÁᤤ
-- diff¤È¤«log¤È¤«¥µ¥¯¥µ¥¯¡£
- ¥í¡¼¥«¥ë¤Ë¤¹¤Ù¤Æ¤¢¤ë¤Î¤Ç¡¢¥Ó¥Ó¤é¤º¤Ëcommit¤Ç¤¤ë¡£
-- ¤°¤Á¤ã¤°¤Á¤ã¤·ÊüÂê
- ¥Ö¥é¥ó¥Á¤¬¶¯ÎÏ
-- ´Êñ¤Ë¥Ö¥é¥ó¥ÁºîÀ®
-- ´Êñ¤Ë¥Ö¥é¥ó¥Á´Ö¤ò¥Þ¡¼¥¸
--- ¤É¤Î¥¿¥¤¥ß¥ó¥°¤«¤é¥Ö¥é¥ó¥Á¤·¤¿¤Î¤«¡¢¥Ö¥é¥ó¥Á¥Ý¥¤¥ó¥È¤ò³Ð¤¨¤Æ¤¤¤ë
--- ¥Þ¡¼¥¸¤µ¤ì¤¿¤«¤É¤¦¤«¤ò³Ð¤¨¤Æ¤¤¤ë
-- ´Êñ¤Ë¥Ö¥é¥ó¥Áºï½ü
-- ¼Â¤Ï¥í¡¼¥«¥ë¥ì¥Ý¥¸¥È¥ê¤«¤é¤ß¤Æ¥Þ¥¹¥¿¡¼¥ì¥Ý¥¸¥È¥ê¤â¥Ö¥é¥ó¥Á
-- ¼Â¤Ï¥í¡¼¥«¥ë¥ì¥Ý¥¸¥È¥ê¤«¤é¤ß¤Æ¥ê¥â¡¼¥È¥ì¥Ý¥¸¥È¥ê¤â¥Ö¥é¥ó¥Á
-- push¤È¤Ï¥ê¥â¡¼¥È¾å¤Î¥Ö¥é¥ó¥Á¤Ëmerge¤·¤Æ¤ë¤Ã¤Æ¤³¤È
** ¤Þ¤º¥í¡¼¥«¥ë¥ì¥Ý¥¸¥È¥ê¥ì¥Ý¥¸¥È¥ê¤ò¿·µ¬¤Ëºî¤Ã¤Æ¤ß¤è¤¦ [#wba7f5f1]
- ¥Á¥å¡¼¥È¥ê¥¢¥ë¤É¤ª¤ê¤Ë
$ tar xzf project.tar.gz
$ cd project
$ git init
Initialized empty Git repository in /home/staff/shida/work/git/project/.git/
- .git¤È¤¤¤¦¥Ç¥£¥ì¥¯¥È¥ê¤¬¤Ç¤¤¿¡£¤³¤ì¤¬¥í¡¼¥«¥ë¥ì¥Ý¥¸¥È¥ê¡£
- ¤³¤ÎÃʳ¬¤Ç¤Ï¡¢¤Þ¤Àproject¤ÎÁ´¥Õ¥¡¥¤¥ë¤Ï¥³¥ß¥Ã¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
- git status¤Ç¸½¾õ¤ò¸«¤Æ¤ß¤ë
$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# file1
# file2
# file3
nothing added to commit but untracked files present (use "git add" to track)
- commitÂоݥե¡¥¤¥ë¤Ï¤Ê¤¤¤¬¡¢ file1, file2, file3¤¬untracked file¤Î¾õÂÖ¤À¡£¤È¤Î¤³¤È¡£
- git add¤ÇÄÉÀ×Âоݤ˲䨤ë
$ git add .
- ¤â¤¦°ì²ógit status ¤Ç¸«¤Æ¤ß¤ë
$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: file1
# new file: file2
# new file: file3
#
- ¤³¤ì¤Ç¡¢commitÂоݤˤʤä¿¡£git commit ¤¹¤ë
$ git commit -m 'file1,2,3¤òÄɲÃ'
[master (root-commit) 0bb8c14] file1,2,3¤òÄɲÃ
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file1
create mode 100644 file2
create mode 100644 file3
- ºÆÅÙ¡¢status¤ò¸«¤Æ¤ß¤ë
$ git status
# On branch master
nothing to commit (working directory clean)
- ºî¶È¥Ç¥£¥ì¥¯¥È¥ê¤Ï¥¯¥ê¡¼¥ó¤È¤Î¤³¤È
- history¤ò¸«¤Æ¤ß¤ë
$ git log
commit 0bb8c14ea62d2b0f0021dc7d1cc217b970e2e706
Author: Yuki SHIDA <shida@ark-web.jp>
Date: Tue Sep 8 16:10:40 2009 +0900
file1,2,3¤òÄɲÃ
- git¤Î¥ê¥Ó¥¸¥ç¥ó¤Ïsvn¤Î¤è¤¦¤ÊÄ̤·ÈÖ¹æ¤Ç¤Ï¤Ê¤¯¡Ö0bb8c14ea62d2b0f0021dc7d1cc217b970e2e706¡×¤È¤¤¤Ã¤¿Ä¹¤¤¥Ï¥Ã¥·¥å¡£
- ¶¦Æ±³«È¯¼Ô´Ö¤Ç¡¢º¹Ê¬¤ò¥æ¥Ë¡¼¥¯¤ËÆÃÄê¤Ç¤¤ë¤è¤¦¤Ê̾Á°ÉÕ¤±¤¬É¬Íפʤ¿¤á¡£
** ¥¹¥Æ¡¼¥¸¥ó¥°¥¨¥ê¥¢¤È¤«¥¤¥ó¥Ç¥Ã¥¯¥¹¤È¤¤¤¦¤ä¤Ä [#gc5bf8e1]
- git¤Ç¤Ï3¤Ä¤Î³µÇ°¤¬¤¢¤ë
-- ºî¶È¥Ç¥£¥ì¥¯¥È¥ê
-- ¥¹¥Æ¡¼¥¸¥ó¥°¥¨¥ê¥¢
-- ¥ì¥Ý¥¸¥È¥ê
- ºî¶È¥Ç¥£¥ì¥¯¥È¥ê¤ÎÆâÍƤϰìö¥¹¥Æ¡¼¥¸¥ó¥°¥¨¥ê¥¢¤Ë¾å¤²¤Ê¤¤¤È¤¤¤±¤Ê¤¤
- ¤½¤ì¤¬ git add
** ½¤Àµ¤·¤Æ¤ß¤ë [#rf9f88bd]
- ¤Ê¤ó¤«½¤Àµ¤¹¤ë
$ echo "¤Ê¤ó¤«½¤Àµ" >> file1
$ echo "¤Ê¤ó¤«½¤Àµ" >> file2
$ echo "¤Ê¤ó¤«½¤Àµ" >> file3
- status¤ò¤ß¤ë
$ 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: file1
# modified: file2
# modified: file3
no changes added to commit (use "git add" and/or "git commit -a")
- ¤Þ¤Àfile1, file2, file3¤Ï¥³¥ß¥Ã¥ÈÂоݤǤϤʤ¤
$ git add file{1,2,3}
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: file1
# modified: file2
# modified: file3
- ¤³¤ì¤Ç¥¹¥Æ¡¼¥¸¥ó¥°¥¨¥ê¥¢¤ËÄɲ䵤줿
- git diff --cached ¤Ç¥¹¥Æ¡¼¥¸¥ó¥°¥¨¥ê¥¢¤È¥ì¥Ý¥¸¥È¥ê¤ÎÈæ³Ó¤¬¤Ç¤¤ë
$ git diff --cached
diff --git a/file1 b/file1
index e69de29..ec1e872 100644
--- a/file1
+++ b/file1
@@ -0,0 +1 @@
+¤Ê¤ó¤«½¤Àµ¤Ê¤ó¤«½¤Àµ
diff --git a/file2 b/file2
index e69de29..7c15ca3 100644
--- a/file2
+++ b/file2
@@ -0,0 +1 @@
+¤Ê¤ó¤«½¤Àµ
diff --git a/file3 b/file3
index e69de29..7c15ca3 100644
--- a/file3
+++ b/file3
@@ -0,0 +1 @@
- ñ¤Ê¤ëgit diff ¤À¤Èºî¶È¥Ç¥£¥ì¥¯¥È¥ê¤È¥¹¥Æ¡¼¥¸¥ó¥°¥¨¥ê¥¢¤È¤Îº¹Ê¬¤òɽ¼¨
$ touch file4
$ git commit -m 'file4ÄɲÃ' file4
$ echo "¤Ê¤ó¤«½¤Àµ" >> file4
$ git diff
diff --git a/file4 b/file4
index e69de29..8009f23 100644
--- a/file4
+++ b/file4
@@ -0,0 +1 @@
+aaa¤Ê¤ó¤«½¤Àµ
- commit -a ¤È¤¹¤ë¤È¡¢¿·µ¬Äɲåե¡¥¤¥ë¤Ç¤Ê¤±¤ì¤Ðadd¤·¤Ê¤¯¤Æ¤âcommit¤Ç¤¤ë
$ git commit -a -m 'file4¤âadd¤·¤Ê¤¯¤Æ¤âcommit¤µ¤ì¤ë¤è'
[master 582a14c] file4¤âadd¤·¤Ê¤¯¤Æ¤âcommit¤µ¤ì¤ë¤è
4 files changed, 4 insertions(+), 0 deletions(-)
** ¥Ö¥é¥ó¥Á´ÉÍý [#m71b4f66]
- ¡Öexperimental¡×¤È¤¤¤¦¥Ö¥é¥ó¥Á¤òºî¤ë
$ git branch experimental
- º£¤³¤Î¥ì¥Ý¥¸¥È¥ê¤Ë¸ºß¤¹¤ë¥Ö¥é¥ó¥Á°ìÍ÷
$ git branch
experimental
* master
- ¡Ö*¡×¤¬ÉÕ¤¤¤Æ¤ë¤Î¤¬º£Áàºî¤·¤Æ¤¤¤ë¥Ö¥é¥ó¥Á¡£¤À¤«¤é¡¢º£Áàºî¤·¤Æ¤¤¤ë¤Î¤Ï¡Ömaster¡×¥Ö¥é¥ó¥Á¡£¤³¤ì¤Ï¥ì¥Ý¥¸¥È¥ê¤ËºÇ½é¤«¤é¤¢¤ë¥Ö¥é¥ó¥Á¡£
- git checkout¤Ç¥Ö¥é¥ó¥Á¤òÀÚ¤êÂؤ¨
$ git checkout experimental
Switched to branch 'experimental'
$ git branch
* experimental
master
- expermimental¥Ö¥é¥ó¥Á¾å¤Ç½¤Àµ¤ò¤·¤Æ¤ß¤ë
$ echo "¥Ö¥é¥ó¥Á¾å¤Ç¤Ê¤ó¤«½¤Àµ" >> file1
$ git commit -a -m "file1¤Ë¥Ö¥é¥ó¥Á experimental ¤«¤é½¤Àµ"
[experimental dd78c7e] file1¤Ë¥Ö¥é¥ó¥Á experimental ¤«¤é½¤Àµ
1 files changed, 1 insertions(+), 0 deletions(-)
- master¥Ö¥é¥ó¥Á¤ËÌá¤Ã¤Æ¡¢¥Þ¡¼¥¸¤·¤Æ¤ß¤ë
$ git checkout master
Switched to branch 'master'
$ git branch
experimental
* master
$ git merge experimental
Updating 582a14c..dd78c7e
Fast forward
file1 | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
- merge¤Ïsvn merge¤È°ã¤Ã¤Æconflict¤·¤Ê¤±¤ì¤Ð®¹¶commit¤µ¤ì¤ë
$ git status
# On branch master
nothing to commit (working directory clean)
$ git log
commit dd78c7e439e3973c1eef2c60b1a4eb43ae31a53b
Author: Yuki SHIDA <shida@ark-web.jp>
Date: Tue Sep 8 16:30:19 2009 +0900
file1¤Ë¥Ö¥é¥ó¥Á experimental ¤«¤é½¤Àµ
- ¥Þ¡¼¥¸ºÑ¤ß¤Î¥Ö¥é¥ó¥Á¤Ïºï½ü¤¹¤ë
$ git branch -d experimental
Deleted branch experimental (was dd78c7e).
$ git branch
* master
-
#blikifooter(»ÖÅÄ)