git & x codepptx

9
http:// techmaster.vn Git & XCode Nguyen Thanh Dat

Upload: thanh-dat-nguyen

Post on 28-Jun-2015

1.012 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Git & x codepptx

http://techmaster.vn

Git & XCode

Nguyen Thanh Dat

Page 2: Git & x codepptx

http://techmaster.vn

Add .gitignore

Copy file .gitignore vào thư mục gốc của project

Page 3: Git & x codepptx

http://techmaster.vn

Terminal

Open terminal ,cd tới thư mục gốc của project và đánh lệnh sau

git initgit add .git commit –m “Commit init”

git remote add origin GIT_URL

git push origin master

Check lại source code trên website

Page 4: Git & x codepptx

http://techmaster.vn

Push, Commit, Pull on XCode

Page 5: Git & x codepptx

http://techmaster.vn

Versions

Giúp cho việc theo dõi và so sánh sự thay đổi giữa các lần commit với nhau.

Page 6: Git & x codepptx

http://techmaster.vn

Branch

Open organizer window (Window->Organizer), click vao tab Repository

Page 7: Git & x codepptx

http://techmaster.vn

Branch

Branch là 1 nhánh các commit.Ví dụ: trước khi thực hiện việc thay đổi UI cho iPhone. Add new branch iPhoneUI và switch sang branch này

Nếu muốn back lại các thay đổi, thì switch về branch trước đó.

Page 8: Git & x codepptx

http://techmaster.vn

Switch branch

Page 9: Git & x codepptx

http://techmaster.vn

Merge branch

• Ví dụ có 2 nhánh: Master và iPhoneUI

• Để merge các thay đổi trên iPhoneUI vào nhánh master. Thì switch tới nhánh master và chọn merge (File/source control/merge)

• Xcode sẽ hiện thị ra 1 combo box chọn iPhoneUI. Tiếp theo xác nhận lại những đoạn code muốn thay đổi