ã¢ãªã¹ã¨ããã®ãµã¼ãã¼ãgit pushãã¡ããã¨ç解ãããï¼
ã¢ãªã¹ã¨ããã®Gitã·ãªã¼ãºãæ¬ã«ãªãã¾ããï¼
ããã¢ãªã¹ã¨ããã®Gitå ¥éã¬ãã¹ã³
ä¸è¨ã®æ¥è¨ããç¶ããã¢ãªã¹ã¨ããã®è¨é²ã
åææ¡ä»¶
- ã¢ãªã¹ã¨ããã¯åããã·ã³ã«ãã°ã¤ã³ããç°ãªãã¦ã¼ã¶ã¼ã
- ãã¡ã¤ã«ã·ã¹ãã ããã¢ã¯ã»ã¹ããåã«ã¯ããµã¼ãã¼ã®è¨å®ã¯ä¸è¦ã«ãªãã®ã§ãããã§è©±ãã·ã³ãã«ã«ãªãã
å ±égitãªãã¸ããªã®æºå
æè¿ãã¢ãªã¹ã«ã¯ã¡ãã£ã¨ããæ©ã¿ããã£ãã
- ç¾å¨ããã®ããã¸ã§ã¯ãã¯ã¢ãªã¹ã¨ããã®äºäººã§ãä¿®æ£ãããé£çµ¡ãåãåã£ã¦ããäºãã®å¤æ´ããã¦ã³ãã¼ãããï¼git pullããï¼ãã¨ã§åæãã¨ã£ã¦ããã
- ããããããã¸ã§ã¯ãã¡ã³ãã¼ãå¢ããå ´åããã®ããæ¹ã§ã¯åæããæéãç ©éã«ãªã£ã¦ãã¾ã...ã
- çæ³ã¯ããµã¼ãã¼ã¨ãªãgitãªãã¸ããªã決ãã¦ãä½æ¥åã«ãããããã¦ã³ãã¼ããä¿®æ£ãããããã«ã¢ãããã¼ããç¹°ãè¿ãæ¹å¼ã«ãããã
ã¢ãªã¹ãããã«ç¸è«ããã¨ãããã¯ã¢ãªã¹ã®ãã·ã³ã§æä½ãã¦ããã£ã¨ããéã«å®ç¾ãã¦ãããã
alice/project$ git clone --bare /Users/alice/project /Users/Shared/project.git
Initialized empty Git repository in /Users/Shared/project.git/
- ä¸è¨ã³ãã³ãã§ä½æããããã©ã«ãã®ã¢ã¯ã»ã¹æ¨©ããeveryoneèªã¿ï¼æ¸ãOKã«ãã¦ãå å ãã¦ããé ç®ãã¹ã¦ã«é©ç¨ãããï¼Finderããæä½ãããï¼
- git cloneã¯git管çã®ãã©ã«ããã³ãã¼ããã³ãã³ããªã®ã ãã--bareãªãã·ã§ã³*1ãæå®ãããã¨ã§...
- /Users/alice/project/.gitãã©ã«ãã/Users/Shared/project.gitãã©ã«ãã¸ã³ãã¼ãã¦ããããï¼gitã管çããã¹ãããã·ã§ããã¨è¨å®ã ããã³ãã¼ããããå®å ¨ã«åãã§ã¯ãªãããµã¼ãã¼ã¨ãã¦å¿ è¦ãªè¨å®ã«ãªãããã ï¼
- gitã«ã¨ã£ã¦éè¦ãªã®ã¯ãå¤åã®å±¥æ´ãã¹ãããã·ã§ããã¨ãã¦ä¿åãããã¼ã¿ã¨ãã®è¨å®ãã¤ã¾ã.gitãã©ã«ãã§ããã
- ã¦ã¼ã¶ã¼ãæä½ããããã¹ããã¡ã¤ã«ã¯ãä½æ¥çµæãè¨é²ããä¸æçãªãã¡ã¤ã«ã§ãããªããï¼...ã¨æããï¼
ããã§ã/Users/Shared/project.gitã¨ããå
±éã®gitãªãã¸ããªãåºæ¥ãã
- ã¢ãªã¹ã¨ããã¯ä»å¾ãä½æ¥ã®åå¾ã«/Users/Shared/project.gitã¨åæãããã¨ã«ãã£ã¦ããäºãã®ä½æ¥ã確èªãåããã¨ã«ãªãã*2
- å ·ä½çã«ã¯ä»¥ä¸ã®æä½ãï¼ä»ã¯ã³ãã¼ããç´å¾ãªã®ã§ãåæãããç¶æ ã ãï¼
alice/project$ git pull /Users/Shared/project.git master From /Users/Shared/project * branch master -> FETCH_HEAD Already up-to-date. alice/project$ git push /Users/Shared/project.git master Everything up-to-date
- git pushã«ãã£ã¦ã/Users/Shared/project.gitã®masterãã©ã³ãã¸ã¢ãããã¼ããã¦ããã
ããã®ä½æ¥
- ããã¯ååä¿®æ£ããaboutã¡ã½ããã«ãã°ãè¦ã¤ãããæ©éãæ°ããéç¨æ¹æ³ã§gitãæä½ãã¦ã¿ãã
- ã¾ãæåã«ããã¯ã/Users/Shared/project.gitã«sharedã¨ããç¥ç§°ãè¨å®ãããï¼ãã®æ¹ãç°¡æ½ã«å ¥åã§ããï¼
- ããã¯ãã®å¾ãå ±éãªãã¸ããªsharedã®masterãã©ã³ããããã«ã
bob/myrepo$ git remote add shared /Users/Shared/project.git bob/myrepo$ git pull shared master From /Users/Shared/project * branch master -> FETCH_HEAD Already up-to-date.
- å¼å±éãå«ãæååãã·ã³ã°ã«ã¯ã©ã¼ãã§å²ã£ã¦ããã®ã§ãããã«ã¯ã©ã¼ãã«å¤æ´ããã
# About git Class WhatIsGit def show puts 'Git is easy, if you understand the basis.' end def about(lang = 'en') puts "http://#{lang}.wikipedia.org/wiki/Git" end end
- ããã¯ãã®å¾ãã³ããã
bob/myrepo$ git commit -a -m "changed to double quotation marks"
Created commit f85e8dc: about URL changed3
1 files changed, 1 insertions(+), 1 deletions(-)
- ããã¯ãã®å¾ãããã·ã¥
bob/myrepo$ git push shared master
Counting objects: 5, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 291 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /Users/Shared/project.git
52cfe0d..16150ca master -> master
ç¡äºãå ±égitãªãã¸ããªã«åæ ãããããã ã
ã¢ãªã¹ã®ä½æ¥
- ã¨ããã§ãã¢ãªã¹ãä½æ¥ããåã«ãã«ããã¨...
alice/project$ git pull /Users/Shared/project.git master
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /Users/Shared/project
* branch master -> FETCH_HEAD
Updating 52cfe0d..16150ca
Fast forward
what_is_git.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
- ä½ããã®å¤æ´ããã¦ã³ãã¼ããããããã ãã¢ãªã¹ã¯å±¥æ´ã確èªãã¦ã¿ãã
alice/project$ git log commit 16150ca79dc873b972edb6570bf750a99ddf80fe Author: bobDate: Wed Sep 10 16:36:59 2008 +0900 changed to double quotation marks commit 52cfe0de979425dbf1dcef3d081e06ea40a68965 Merge: 616c5cb... fb7c82f... Author: alice Date: Mon Sep 8 17:44:48 2008 +0900 Merge /Users/bob/myrepo Conflicts: what_is_git.rb commit fb7c82fda542762554792fc9b198428a3e6ae5b3 Author: bob Date: Mon Sep 8 16:11:45 2008 +0900 git is easy! ...ï¼ä¸ç¥ï¼...
- ã¢ãªã¹ã¯ããã«è©³ç´°ã確èªããã¨...
$ git show commit 16150ca79dc873b972edb6570bf750a99ddf80fe Author: bobDate: Wed Sep 10 16:36:59 2008 +0900 changed to double quotation marks diff --git a/what_is_git.rb b/what_is_git.rb index 103a58e..ac3f723 100644 --- a/what_is_git.rb +++ b/what_is_git.rb @@ -5,6 +5,6 @@ Class WhatIsGit end def about(lang = 'en') - puts 'http://#{lang}.wikipedia.org/wiki/Git' + puts "http://#{lang}.wikipedia.org/wiki/Git" end end
ã¢ãªã¹ã¯ãããããã¾ã«ã¯ééãã®ãï¼ãã¨åããã
ææ
- å½åãgit pushã¯git pullã¨ã¯ãã¼ã¿ã®æµããå対ã®åããããã ãã§ããã¨ã¯åãã¨èãã¦ããã
- ããããå®éã«ä½¿ã£ã¦ã¿ãã¨ããã以å¤ã«å¤§ããªéãããããã¨ã«æ°ä»ãã
- git pullã¯å±¥æ´ãã¼ã¿ãåãåã人ããèªåã®å¥½ããªã¿ã¤ãã³ã°ã§å®è¡ãããã¨ãåºæ¥ãã
- git pushã§ã¯ããã¼ã¿ãåãåã人ã¯ãå¤é¨ãããã¤ã®ã¿ã¤ãã³ã°ã§éä¿¡ããã¦ããã®ãäºæ³ã§ããªãã
- ãã®ãããgit pullã¯èªåã®ä½æ¥ãã£ã¬ã¯ããª*3ã§ãã®ã¾ã¾å®è¡ããåæãããå 容ã«ä½æ¥ãã¡ã¤ã«ã®ç¶æ ãå³æ´æ°ããããã
- git pushã¯ãgit pushå°ç¨ã®.gitãã©ã«ããç¨æãã¦ããã®å°ç¨ãã©ã«ãã«å¯¾ãã¦ã®ã¿git pushããä»æ§ã¨ãªã£ã¦ããããã ã
- ããããã¡ã¤ã«ãä¿®æ£ä¸ã«å¤é¨ãã次ã ããã·ã¥ããæçµã®ã³ããããå¤åã¦ãã¾ã£ããããã®ã¦ã¼ã¶ã¼ã¯æ··ä¹±ãã¦ãã¾ããã¨ã«ãªãã ããã
- /Users/alice/projectãã©ã«ãã«å¯¾ãã¦git psuhãããã¨ãå¯è½ãªããã ããéç¨ã¨ãã¦git pushããªãããã«ããã®ãä¸è¬çãªããã ã
- ãã©ã«ãã«ã¢ã¯ã»ã¹æ¨©ãè¨å®ãã¦ããã°ãåéãã®git pushãé²æ¢ã§ããã¯ãã
*1:bare=裸ã®ãããåºãã®ãã¨ããæå³ããã
*2:ãã¡ãããä»ã¾ã§ã®git pullã§ãåæã§ãããã/Users/Shared/project.gitãææ°ã®ç¶æ ã«ãªã£ã¦ããªãã¨ããã£ãããããè¨å®ããæå³ããªãã
*3:.gitãã©ã«ã以å¤ã®ãå®éã«ç·¨éãããã¡ã¤ã«ãå«ããã©ã«ã