顯示具有 git 標籤的文章。 顯示所有文章
顯示具有 git 標籤的文章。 顯示所有文章

2012年8月20日 星期一

Xcode的scheme共享

好東西要和好朋友分享,對於開發App的工程師來說,Xcode上的scheme影響了App的生成和包裝,絕對是不能不享的必需品。接下來就讓彼得潘示範如何和團隊伙伴們共享scheme吧。


1. 在github上建立專案ShareScheme

2. 建立Xcode專案ShareScheme

3. 將Xcode專案ShareScheme和github做連結

git remote add origin https://github.com/deeplovepan/ShareScheme.git
git push -u origin master

4. 新增scheme "ShareScheme for peter pan"

從scheme清單裡點選Manage Schemes



新增ShareScheme for peter pan,並將Scheme列表裡欲共享的對象都勾選。( Shared欄位)



5. 將分享的scheme加入git管理

前一步勾選Shared後,專案下將生成xcshareddata資料夾,此資料夾下為我們想要和朋友共享的檔案。

(1) git status
->

# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
# ShareScheme.xcodeproj/project.xcworkspace/
# ShareScheme.xcodeproj/xcshareddata/
# ShareScheme.xcodeproj/xcuserdata/



(2) git add ShareScheme.xcodeproj/xcshareddata/

(3) git status

# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
# new file:   ShareScheme.xcodeproj/xcshareddata/xcschemes/ShareScheme for peter pan.xcscheme
# new file:   ShareScheme.xcodeproj/xcshareddata/xcschemes/ShareScheme.xcscheme
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
# ShareScheme.xcodeproj/project.xcworkspace/
# ShareScheme.xcodeproj/xcuserdata/


(4) git commit -a

(5) git push

經過以上步驟,當彼得潘的好朋友溫蒂從github下載ShareScheme專案時,將幸福地一次擁有ShareScheme和ShareScheme for peter pan兩個Scheme。




2012年3月13日 星期二

git submodule的使用

在UseShareLibraryProject1 project裡加入ShareLibrary project


1. git submodule add git@github.com:deeplovepan/ShareLibrary.git
   將ShareLibrary抓下來

2. git commit
    commit ShareLibrary和.gitmodules
 
3. git submodule init
   更新.git/config
  ->
  多了
  [submodule "ShareLibrary"]
   url = git@github.com:deeplovepan/ShareLibrary.git

在UseShareLibraryProject1裡修改submodule ShareLibrary

1. cd ShareLibrary/ShareLibrary, modify ShareLibraryAppDelegate.m

2. git add ShareLibrary/ShareLibraryAppDelegate.m

3. git commit

4. git push
   從push只修改到github上的ShareLibrary project

5. 回到UseShareLibraryProject1根目錄, 從根目錄commit和push,
   如果才會更新UseShareLibraryProject1採用的submodule版本

6. git add ShareLibrary

7. git commit

8. git push


其它人抓取UseShareLibraryProject1

1. git clone git@github.com:deeplovepan/UseShareLibraryProject1.git

2. git submodule init
    更新.git/config,多了submodule的資訊

3. git submodule update
    抓取submodule內容


其它人更新UseShareLibraryProject1

1. git pull
   更新紀錄的submodule資訊,此時打git submoule,
   若開頭有+,表示submodule內容有修改,需更新
   ex:
   +be295206e07a1eeb6243fa5ee2466c1f6e990e94 ShareLibrary
 
2. git submodule update
   若submodule有更新,抓取submodule內容



只針對UseShareLibraryProject1下的ShareLibrary更新,因為github上的ShareLibrary project有修改



1. 切換至UseShareLibraryProject1下的ShareLibrary

2. git pull origin master

3. 回到UseShareLibraryProject1根目錄
   此時打git submodule將出現以下訊息
   +27c6861c06fdb3a9c82d9b70d41f6287bc068961 ShareLibrary (remotes/origin/HEAD)
   開頭的+表示submodule被更動了
 
4. git add ShareLibrary

5. git commit
   此時再打git submodule,開頭的+不見了
   27c6861c06fdb3a9c82d9b70d41f6287bc068961 ShareLibrary
 
6. git push





2012年3月9日 星期五

github和Xcode的結合

1. 在Mac上從Xcode 建立新專案PeterPanCocoaLib

從organizer視窗的Repositories分頁找到PeterPanCocoaLib,此時可看到已經有了第一次的Initial Commit。



2. 在github上建立專案PeterPanCocoaLib,取得SSH連結



3. 在organizer視窗的Repositories分頁找到PeterPanCocoaLib

點選Remotes -> Add Remote



4. 輸入remote資訊
name:   origin
Location:  SSH連結




5. 將Mac上的專案PeterPanCocoaLib push到remote







2012年2月23日 星期四

get specific branch from Xcode

method 1:

1. Window -> Organizer -> Repositories

2. Add Repository


3.  select branch , then click clone button




method 2:

1. Window -> Organizer -> Repositories

2. Checkout or Clone Repository
    this will clone master 


3. click Remotes, then select branch


 2. Track Branch

2012年2月20日 星期一

find current branch

  click blue project folder  




  Current branch is shown on the bar of right panel 




從Xcode建立branch

1. File -> Source Control  -> Repositories


 


2. click Branches


3. click Add Branch






2011年4月15日 星期五

2011年3月24日 星期四

git

1. 將local端的資料上傳到server端的某個branch
ex:
git push origin testBranch
testBranch是branch的名稱

2. add local project to remote server
ex:
git remote add origin git@github.com:deeplovepan/DeeploveProgram.git


git push -u origin master

3. 比較不同的branch
git diff --name-status branch1 branch2

4. 比較不同branch的某個檔案
git difftool branch1:config/test.m branch2:config/test.m